httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <>
Subject Re: Potential memory leak in /modules/cache/mod_mem_cache.c
Date Wed, 02 Nov 2005 22:42:24 GMT

On 11/02/2005 10:54 PM, Bill Stoddard wrote:
> Ruediger Pluem wrote:


>> Finding calls to malloc and friends in the code of mod_mem_cache is a
>> clear documentation
>> that there is no development care of this code as they should not be
>> used inside of
>> httpd code. Throughout the httpd code memory pools will be used to
>> aquire memory for storing
>> data structures.
> mod_mem_cache does not use pools to store objects because it is not
> straightforward how to recover pool storage when stale cache objects are
> removed from the cache. For example, if you have 10,000 objects in the
> mem cache and you need to garbage collect 1837 of them, how do you do it
> (and return the memory to the system) if all 10,000 objects are
> allocated out of the same pool? There are ways of doing it, but not
> straigtforward.

Ok. You got me :-). I should have taken a closer look at the code before.
I agree that this problem is not straightforward to solve, especially not
for someone who is not that deep into pools like me and who still has a lot
to learn in this area.

In order to improve my understanding of mod_mem_cache at which I had
a (more) closer look than before I would like to ask some questions:

For whatever reason I firmly believed that mod_mem_cache has a common cache
via shared memory over all httpd processes. This does not seem to be true, correct?

But if each httpd process maintains its own local cache, this would mean
that the same object needs to be cached multiple times if clients request
the same object from different httpd processes. This would

- increase the load on the backend
- increase the thundering herd problem for stale cache entries
- increase memory usage per object as each httpd process does have a local
  copy of it in memory.

Do I see this correct?



View raw message