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

2011-06-10 Thread Daniel Shahaf
stef...@apache.org wrote on Wed, May 25, 2011 at 22:20:25 -:
> Author: stefan2
> Date: Wed May 25 22:20:25 2011
> New Revision: 1127709
> 
> URL: http://svn.apache.org/viewvc?rev=1127709&view=rev
> Log:
> Fix a pool usage issue: svn_cache__get_partial() may be called many
> times in a row. Thus, the internal pool used to construct keys should
> be cleared in this function as well from time to time.
> 
> * subversion/libsvn_subr/cache-membuffer.c
>   (svn_membuffer_cache_get_partial): regularly clear the internal scratch pool
> 
> 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=1127709&r1=1127708&r2=1127709&view=diff
> ==
> --- subversion/trunk/subversion/libsvn_subr/cache-membuffer.c (original)
> +++ subversion/trunk/subversion/libsvn_subr/cache-membuffer.c Wed May 25 
> 22:20:25 2011
> @@ -1668,6 +1668,12 @@ svn_membuffer_cache_get_partial(void **v
>  
>DEBUG_CACHE_MEMBUFFER_INIT_TAG
>  
> +  if (++cache->alloc_counter > ALLOCATIONS_PER_POOL_CLEAR)
> +{
> +  apr_pool_clear(cache->pool);
> +  cache->alloc_counter = 0;
> +}
> +

Does this need to be guarded by a cache lock?

>combine_key(cache->prefix,
>sizeof(cache->prefix),
>key,
> 
> 


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

2011-05-25 Thread stefan2
Author: stefan2
Date: Wed May 25 22:20:25 2011
New Revision: 1127709

URL: http://svn.apache.org/viewvc?rev=1127709&view=rev
Log:
Fix a pool usage issue: svn_cache__get_partial() may be called many
times in a row. Thus, the internal pool used to construct keys should
be cleared in this function as well from time to time.

* subversion/libsvn_subr/cache-membuffer.c
  (svn_membuffer_cache_get_partial): regularly clear the internal scratch pool

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=1127709&r1=1127708&r2=1127709&view=diff
==
--- subversion/trunk/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cache-membuffer.c Wed May 25 
22:20:25 2011
@@ -1668,6 +1668,12 @@ svn_membuffer_cache_get_partial(void **v
 
   DEBUG_CACHE_MEMBUFFER_INIT_TAG
 
+  if (++cache->alloc_counter > ALLOCATIONS_PER_POOL_CLEAR)
+{
+  apr_pool_clear(cache->pool);
+  cache->alloc_counter = 0;
+}
+
   combine_key(cache->prefix,
   sizeof(cache->prefix),
   key,