httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (David Robinson)
Subject Re: CERTifiable nightmare
Date Tue, 14 Mar 1995 21:08:00 GMT
Rob wrote:
>For that sake of any future fork-free apache, everyone should
>make sure they 'free' malloc'ed memory after using it.
However, httpd never frees memory in the child process, the code only ensures
that there is not a store leak in the parent. (True for my patch as well
8-( ) So it will be a lot of work to fix this; maybe some more sophisticated
malloc routines would help. e.g. a malloc which built a list of all the
per-connection data, and had a single routine to free it.
However, you'd still have a problem with increasing amounts of garbage.

A while ago I thought about this in the context of a multi-threaded server,
and the conclusion I came to was that in general you could make do with
a fixed amount of memory for each connection; i.e. no dynamic memory allocation
after connection setup. The only exception was for setting environment variables
for CGI scripts; but as the script will be run as a child, the allocation could
be done after the fork() but before the exec(). So I was quite disappointed
to find httpd mallocing lots of arrays whilst processing a request.


View raw message