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

Re: pool usage (was: Re: CVS update: subversion/subversion/libsvn_fs rev-table.c)

From: Jim Blandy <jimb_at_zwingli.cygnus.com>
Date: 2001-03-15 20:19:36 CET

Greg Stein <gstein@lyra.org> writes:
> I believe the hardest question is how the caller should determine their own
> behavior. Let's say the caller has an unbounded loop, creating streams. They
> cannot simply pass the same pool to each svn_stream_create() function,
> because they could end up with a billion streams in that one pool. Thus, the
> guy doing the loop will create a subpool, then call svn_stream_create
> passing the subpool, then clear the subpool and loop. If the create function
> then decides to create a subpool, then we've now got two subpools per
> iteration.
>
> So... this means that option (1) is almost always the proper style. Defer to
> your caller to let them decide how to manage memory. If they are going to
> call you many times, then they may use subpools. Or they simply give you
> their own.

This is pretty persuasive to me. Subpools are for managing loops, so
they should be created by the code doing the loop. Perhaps svn_fs.h
should be revised to match this.
Received on Sat Oct 21 14:36:26 2006

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