You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2015/11/14 20:52:23 UTC

svn commit: r1714356 - /subversion/trunk/subversion/libsvn_subr/cache-membuffer.c

Author: stefan2
Date: Sat Nov 14 19:52:23 2015
New Revision: 1714356

URL: http://svn.apache.org/viewvc?rev=1714356&view=rev
Log:
Fix capacity check in the membuffer cache's prefix pool.
The current implementation used only about 1% of its capacity.

* subversion/libsvn_subr/cache-membuffer.c
  (prefix_pool_get_internal): Actually check byte usage against bytes
                              limit - not entry count limit.

Modified:
    subversion/trunk/subversion/libsvn_subr/cache-membuffer.c

Modified: subversion/trunk/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cache-membuffer.c?rev=1714356&r1=1714355&r2=1714356&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cache-membuffer.c Sat Nov 14 19:52:23 2015
@@ -353,7 +353,8 @@ prefix_pool_get_internal(apr_uint32_t *p
     }
 
   bytes_needed = prefix_len + 1 + OVERHEAD;
-  if (prefix_pool->bytes_used + bytes_needed > prefix_pool->values_max)
+  assert(prefix_pool->bytes_max >= prefix_pool->bytes_used);
+  if (prefix_pool->bytes_max - prefix_pool->bytes_used > bytes_needed)
     {
       *prefix_idx = NO_INDEX;
       return SVN_NO_ERROR;