You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Shahaf <da...@elego.de> on 2011/07/29 01:31:22 UTC

[PATCH] set cachebuffer allocator owner

The following patch:

[[[
Index: subversion/libsvn_subr/svn_cache_config.c
===================================================================
--- subversion/libsvn_subr/svn_cache_config.c	(revision 1152032)
+++ subversion/libsvn_subr/svn_cache_config.c	(working copy)
@@ -113,6 +113,7 @@ svn_cache__get_global_membuffer_cache(void)
       apr_pool_create_ex(&pool, NULL, NULL, allocator);
       if (pool == NULL)
         return NULL;
+      apr_allocator_owner_set(allocator, pool);
 
       err = svn_cache__membuffer_cache_create(
           &new_cache,
]]]

causes the following valgrind warning to disappear:

[[[
==28089== 104 bytes in 1 blocks are definitely lost in loss record 1 of 1
==28089==    at 0x4023F50: malloc (vg_replace_malloc.c:236)
==28089==    by 0x41E7F7E: apr_allocator_create (apr_pools.c:124)
==28089==    by 0x419B16F: svn_cache__get_global_membuffer_cache (svn_cache_config.c:94)
==28089==    by 0x457B5FC: svn_fs_fs__initialize_caches (caching.c:261)
==28089==    by 0x457F117: fs_create (fs.c:192)
==28089==    by 0x43D396F: svn_fs_create (fs-loader.c:411)
==28089==    by 0x43C04E5: svn_repos_create (repos.c:1260)
==28089==    by 0x4097949: svn_test__create_repos (svn_test_fs.c:215)
==28089==    by 0x805FBC0: create_repos_and_wc (utils.c:77)
==28089==    by 0x805FFF5: svn_test__sandbox_create (utils.c:151)
==28089==    by 0x805390B: test_delete_of_replace (op-depth-test.c:1792)
==28089==    by 0x409AE1D: do_test_num (svn_test_main.c:275)
]]]

Can I have a +1?  I looked up the APR docs, but they were less than useful.

Re: [PATCH] set cachebuffer allocator owner

Posted by Stefan Fuhrmann <eq...@web.de>.
On 29.07.2011 09:25, Bert Huijben wrote:
>
>> -----Original Message-----
>> From: Daniel Shahaf [mailto:danielsh@elego.de]
>> Sent: vrijdag 29 juli 2011 1:31
>> To: dev@subversion.apache.org
>> Subject: [PATCH] set cachebuffer allocator owner
>>
>> The following patch:
>>
>> [[[
>> Index: subversion/libsvn_subr/svn_cache_config.c
>> ==========================================================
>> =========
>> --- subversion/libsvn_subr/svn_cache_config.c	(revision 1152032)
>> +++ subversion/libsvn_subr/svn_cache_config.c	(working copy)
>> @@ -113,6 +113,7 @@ svn_cache__get_global_membuffer_cache(void)
>>         apr_pool_create_ex(&pool, NULL, NULL, allocator);
>>         if (pool == NULL)
>>           return NULL;
>> +      apr_allocator_owner_set(allocator, pool);
>>
>>         err = svn_cache__membuffer_cache_create(
>>             &new_cache,
>> ]]]
>>
>> causes the following valgrind warning to disappear:
>>
>> [[[
>> ==28089== 104 bytes in 1 blocks are definitely lost in loss record 1 of 1
>> ==28089==    at 0x4023F50: malloc (vg_replace_malloc.c:236)
>> ==28089==    by 0x41E7F7E: apr_allocator_create (apr_pools.c:124)
>> ==28089==    by 0x419B16F: svn_cache__get_global_membuffer_cache
>> (svn_cache_config.c:94)
>> ==28089==    by 0x457B5FC: svn_fs_fs__initialize_caches (caching.c:261)
>> ==28089==    by 0x457F117: fs_create (fs.c:192)
>> ==28089==    by 0x43D396F: svn_fs_create (fs-loader.c:411)
>> ==28089==    by 0x43C04E5: svn_repos_create (repos.c:1260)
>> ==28089==    by 0x4097949: svn_test__create_repos (svn_test_fs.c:215)
>> ==28089==    by 0x805FBC0: create_repos_and_wc (utils.c:77)
>> ==28089==    by 0x805FFF5: svn_test__sandbox_create (utils.c:151)
>> ==28089==    by 0x805390B: test_delete_of_replace (op-depth-test.c:1792)
>> ==28089==    by 0x409AE1D: do_test_num (svn_test_main.c:275)
>> ]]]
>>
>> Can I have a +1?  I looked up the APR docs, but they were less than
> useful.
>
> +1
>
> The common block in our clients is:
>
>    pool = svn_pool_create_ex(NULL, allocator);
>    apr_allocator_owner_set(allocator, pool);
If it still matters: I fully agree with Bert, +1.
Seems I just forgot to add that line.

-- Stefan^2.


RE: [PATCH] set cachebuffer allocator owner

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: Daniel Shahaf [mailto:danielsh@elego.de]
> Sent: vrijdag 29 juli 2011 1:31
> To: dev@subversion.apache.org
> Subject: [PATCH] set cachebuffer allocator owner
> 
> The following patch:
> 
> [[[
> Index: subversion/libsvn_subr/svn_cache_config.c
> ==========================================================
> =========
> --- subversion/libsvn_subr/svn_cache_config.c	(revision 1152032)
> +++ subversion/libsvn_subr/svn_cache_config.c	(working copy)
> @@ -113,6 +113,7 @@ svn_cache__get_global_membuffer_cache(void)
>        apr_pool_create_ex(&pool, NULL, NULL, allocator);
>        if (pool == NULL)
>          return NULL;
> +      apr_allocator_owner_set(allocator, pool);
> 
>        err = svn_cache__membuffer_cache_create(
>            &new_cache,
> ]]]
> 
> causes the following valgrind warning to disappear:
> 
> [[[
> ==28089== 104 bytes in 1 blocks are definitely lost in loss record 1 of 1
> ==28089==    at 0x4023F50: malloc (vg_replace_malloc.c:236)
> ==28089==    by 0x41E7F7E: apr_allocator_create (apr_pools.c:124)
> ==28089==    by 0x419B16F: svn_cache__get_global_membuffer_cache
> (svn_cache_config.c:94)
> ==28089==    by 0x457B5FC: svn_fs_fs__initialize_caches (caching.c:261)
> ==28089==    by 0x457F117: fs_create (fs.c:192)
> ==28089==    by 0x43D396F: svn_fs_create (fs-loader.c:411)
> ==28089==    by 0x43C04E5: svn_repos_create (repos.c:1260)
> ==28089==    by 0x4097949: svn_test__create_repos (svn_test_fs.c:215)
> ==28089==    by 0x805FBC0: create_repos_and_wc (utils.c:77)
> ==28089==    by 0x805FFF5: svn_test__sandbox_create (utils.c:151)
> ==28089==    by 0x805390B: test_delete_of_replace (op-depth-test.c:1792)
> ==28089==    by 0x409AE1D: do_test_num (svn_test_main.c:275)
> ]]]
> 
> Can I have a +1?  I looked up the APR docs, but they were less than
useful.

+1

The common block in our clients is:

  pool = svn_pool_create_ex(NULL, allocator);
  apr_allocator_owner_set(allocator, pool);

	Bert