httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Stoddard <b...@wstoddard.com>
Subject Re: mod_mem_cache & pools
Date Wed, 10 Dec 2003 03:32:52 GMT
Ian Holsman wrote:

> hi.
> 
> I was wondering if the queue/hash routines in mod-mem-cache could be 
> reverted to using the pool based ones, instead of the malloc-based ones.
> 
> and possibly change some of the object creation to pool based as well.
> 
> this would leave the headers/content as malloc'd
> 
> 
> 2 reasons I can see for this:
>     - pool's are faster than malloc
>     - code duplication is ugly.
> 
> thoughts?
> 
> I know it initally was using apr's hash, but we moved it to malloc due 
> to the increasing size problem (I think)
> 
> Regards
> Ian
> 
> 

The reason we use malloc-based memory ops in mod_mem_cache is to prevent storage leaks when
stale cache 
entries are garbage collected (in other words, when an entry is removed from the cache, it
was easy to free 
the headers/body but the few bytes alloc'ed by apr_hash would accumulate indefinitely since
we could not clear 
the pool because other non stale entries were still using the pool). We now have apr_allocator_create(),

apr_allocator_max_free_set() and apr_pool_create_ex() which may let us eliminate the malloc-based
pools in 
mod_mem_cache.

Bill


Mime
View raw message