On 11/10/2010 10:34 AM, Philip Martin wrote:
> Blair Zajac<blair_at_orcaware.com> writes:
>
>>> + /* If we are using fulltext caches etc., we will allocate many large
>>> + chunks of memory of various sizes outside the cachde for those
>>> + fulltexts. Make sure, we use the memory wisely: use an allocator
>>> + that causes memory fragments to be given back to the OS early. */
>>> +
>>> + if (apr_allocator_create(&allocator))
>>> + return EXIT_FAILURE;
>>> +
>>> + apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE);
>>> +
>>> /* Non-standard pool handling. The main thread never blocks to join
>>> the connection threads so it cannot clean up after each one. So
>>> separate pools, that can be cleared at thread exit, are used */
>>> - connection_pool = svn_pool_create(NULL);
>>> +
>>> + connection_pool = svn_pool_create_ex(NULL, allocator);
>>> + apr_allocator_owner_set(allocator, connection_pool);
>>
>>
>> Shouldn't the allocator have a mutex registered with it, given that
>> svnserve is multithreaded?
>
> No. I believe each thread gets its own allocator and pool, from which it
> creates subpools as required. When the thread exits it destroys the
> pool, which destroys the allocator since the pool has been set as the
> owner. So each allocator is only used by one thread.
Thanks Philip for looking into it and seeing that we're fine.
Blair
Received on 2010-11-10 20:38:45 CET