[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r33126 - trunk/subversion/libsvn_wc

From: Greg Stein <gstein_at_gmail.com>
Date: Wed, 17 Sep 2008 08:36:52 -0700

On Wed, Sep 17, 2008 at 8:24 AM, Blair Zajac <blair_at_orcaware.com> wrote:
>...
>> +svn_error_t *
>> +svn_wc__db_open_many(apr_hash_t **dbs,
>> + const apr_array_header_t *paths,
>> + svn_config_t *config,
>> + apr_pool_t *result_pool,
>> + apr_pool_t *scratch_pool);
>
> Why not have svn_wc__db_open_many() create a subpool in result_pool and then
> destroy it when it's done? It's rare for any svn API to take two pool
> arguments.

Most of the functions in wc_db.h take two pools: one for results, and
one for temporary/scratch space. The caller knows much more about
pools' lifetimes and can optimize the behavior much better.
Creating/destroying a scratch pool is "expensive" compared to the
caller possibly *already* having a scratch pool handy.

The basic rule is: never create/destroy a pool within a single
function *except* when it is an "iteration pool" to be used within a
loop and cleared on each iteration.

Taking two pools is better from a memory/lifetime management
perspective, and more of our APIs should take two pools.

Cheers,
-g

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-09-17 17:37:04 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.