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

Re: Allocating from a pool in cleanup

From: Greg Stein <gstein_at_lyra.org>
Date: 2002-11-11 03:12:08 CET

On Sun, Nov 10, 2002 at 11:25:59PM +0100, Sander Striker wrote:
>...
> I can confirm that it is safe to do allocations from the pool being cleaned
> up.

Yup. I was looking at this, too, and it is definitely quite safe to do this,
and it really is the only thing that makes sense. A user should never assume
that it can allocate in a parent pool. You could accumulate a lot of cruft
if you do that.

Note that we've got a lot of code that allocates during cleanup. I did an
abort() when somebody tried that. Wasn't pretty :-)

Sometime over the week, I'll see if I can clean up my patch to allow (again)
the allocate-during-cleanup and post that; basically it would just stop
register-during-cleanup.

Hmm. Well, I've just attached my patch. It doesn't do the right thing, but
it could be simplified to scope it down.

> The problem is registering cleanups in a pool in the process of being
> cleaned up. Opening files, like a lot of other APR operations, registers
> a cleanup with the pool being passed in. It probably wouldn't even be that
> hard to allow registering cleanups during cleanup; I'll look into that.

Set pool->cleanups to NULL before running them. After you're done running
them, run again if cleanups != NULL. Note the potential for an infinite
loop... :-)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Received on Mon Nov 11 06:46:13 2002

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.