apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham Leggett <minf...@sharp.fm>
Subject Re: apr_hash: Memory consumption
Date Tue, 15 Sep 2009 09:27:36 GMT

> I notice that the implementation of expand_array() in
> tables/apr_hash.c allocates a new bucket array, without making any
> attempt to release the memory allocated for the previous bucket array.
> That wastes memory: if the hash table grows exponentially, this
> strategy wastes O(n) extra memory.
> Is there a rational for the current behavior? If not, perhaps the
> easiest fix is to allocate the bucket array in a subpool, and then
> create a new subpool and destroy the old one in expand_array(). If a
> patch to do this would be accepted, let me know and I'll submit one.

If the patch improves performance, then +1 to that.


View raw message