Matthew Hambley <matthew@aether.demon.co.uk> writes:
> As I understand the usage of memory pools in subversion all I can take for
> granted is that the pool passed into a function will exist for the duration
> of the call. However I want to allocate some space which persists for the
> lifetime of the client. What pool should I use which has such a lifespan
> and how would I access it?
What you can take for granted is that any pool your code creates will
not be destroyed by a Subversion API (unless the docstring for that
API explicitly states so -- and I dunno of any that do).
An application generally keeps a single top-most pool around from
which to create short-lived subpools. For example, this code from the
Subversion command-line client:
/* Create our top-level pool. Use a seperate mutexless allocator,
* given this application is single threaded.
*/
if (apr_allocator_create (&allocator))
return EXIT_FAILURE;
apr_allocator_max_free_set (allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE);
pool = svn_pool_create_ex (NULL, allocator);
apr_allocator_owner_set (allocator, pool);
The pool named "pool" here is the top-most pool used by the
command-line client. It or subpools created from it using
"svn_pool_create (pool)" are passed to all the Subversion library
APIs. Stuff that needs to live the during of the application is
allocated from that pool.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jul 5 10:09:09 2005