httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <>
Subject Re: [PATCH] pool confusion (take 1)
Date Mon, 10 Nov 1997 19:36:44 GMT
On Mon, 10 Nov 1997, Dean Gaudet wrote:

> On Sun, 9 Nov 1997, Alexei Kosut wrote:
> > What I'm trying to point out is this: Let's say the main server does a
> > pregcomp() with pconf as the pool. This sets up a cleanup in pconf to
> > get rid of the regex once it's done with (it calls free()). Now, if
> > the main server now spawns a child, that child should certainly want
> > to call that cleanup, since it now has its own copy of the memory
> > that's being freed.
> This is an example of a cleanup that can be performed in the parent, i.e. 
> pconf.  It has to be performed in the parent because of restarts.

It has to be performed in *both* the child and the parent, because
they *both* have a copy of pconf. Seperate copies. Calling a cleanup
on one doesn't clean up the other (unless you're suggesting that pconf
should be made shared memory, which I highly doubt you are).

> > Admittedly, the subsequent exit() does get rid of the said memory, but
> > this is the only example I can think of off the top of my head.
> > 
> > I am convinced, however, that it is neccessary in some cases.
> This is what pchild is for.  If something needs to be cleaned up when the
> child exits, then it's probably only created when the child starts.  One

"probably." I'm saying that this isn't always true. I buy your
rationale that many things only should be cleaned up by the parent,
but not everything. If you're going to do this, then I suggest
creating pchild at the same time as pconf. That way, you always have
an appropriate pool to use.

> thing you missed in your explanation of fork() was how the non-memory
> resources are handled.  flock()'s stuff is an example of something that
> has to be created in the child, and cleaned in the child.  In addition to
> having a different creation/cleanup in the parent.

-- Alexei Kosut <>

View raw message