apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emery Berger" <em...@cs.utexas.edu>
Subject pools + ap_pfree
Date Fri, 01 Mar 2002 03:59:37 GMT
Hi everyone,

Not sure if this is the right place for this, but here goes.

I've recently developed an extended version of pools (called "reaps")
that provides the same semantics but also allows individual objects to
be freed and reused. That is, I add ap_pfree and ap_prealloc to the API.
If you free an object with ap_pfree, it can be reused by a subsequent
ap_palloc. If you don't ever use ap_pfree, it's still lightning fast and
acts like the pools we all know and love :). If you do use ap_pfree,
freed objects are managed using an algorithm based on Doug Lea's
allocator, widely considered to be one of the most memory-efficient and
fastest.

I see a couple of advantages to this approach:

(1) It should simplify module programming; existing code that uses
malloc/free can just use ap_palloc(r->pool)/ap_pfree(r->pool) {say, by
using a #define} and everything will work fine, rather than causing
enormous memory consumption.

(2) Using reaps allows a broader range of memory usage patterns, e.g.
producer-consumer pairs (producer allocs, consumer frees), which don't
fit into the nested subpool paradigm.

So what are your thoughts? One notion I'm also working on is mixing
reaps into Hoard, my scalable general-purpose memory allocator (see
www.hoard.org). But I'm very interested in getting feedback on what the
Apache crowd thinks about using reaps.
 
Thanks,
-- Emery

--
Emery Berger
Dept. of Computer Science
The University of Texas at Austin
www.cs.utexas.edu/users/emery




Mime
View raw message