apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@covalent.net>
Subject Re: [PATCH] fix cleanups in cleanups
Date Fri, 21 Sep 2001 02:54:22 GMT
On Thursday 20 September 2001 05:48 pm, Greg Stein wrote:
> On Thu, Sep 20, 2001 at 11:18:55AM -0700, Aaron Bannert wrote:
> >...
> > Does this fix it for you? All testmem tests passed for me and your code
> > above properly flushes "Cleanup" to the file.
> >
> > (Someone needs to check my work on run_child_cleanups() and make sure
> > that the popping is necessary. It looked to be in the same situation.)
> Calling pop_cleanup() on every iteration is a bit much. Consider the
> following patch:

Why is it a bit much?  I just took a quick look at it, it is an if, and three assignments.
I would assume that any compiler worth it's salt would inline this function as well.

This patch also keeps the LIFO behavior, which is important, because it means 
that it is much less likely that an item allocated out of the pool when the cleanup
was registered will no longer be there when the cleanup is run.

> while ((c = p->cleanups) != NULL) {
>     p->cleanups = NULL;
>     run_cleanups(c);
> }

Which function is this in?  I have looked, but the only place that I can find to
put this code would be in apr_pool_clear, around the run_cleanups code.

> Basically, the above code processes the cleanups in batches. Everything
> that was initially registered is processed, then everything registerd
> during the first cleanup round, etc.

This makes it more more likely that a variable in the same pool that was available
when the cleanup was registered would not be available when your cleanup
ran.  I would really want to see a performance analysis before we broke that

Ryan Bloom				rbb@apache.org
Covalent Technologies			rbb@covalent.net

View raw message