httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <>
Subject Re: [PATCH] pool confusion (take 1)
Date Mon, 10 Nov 1997 08:39:57 GMT

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.

> 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
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.


View raw message