httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <>
Subject Re: memory allocation (was Re: mod_include performance numbers)
Date Sat, 21 Apr 2001 23:39:48 GMT
On Sat, 21 Apr 2001, dean gaudet wrote:

> can you give a short description of this allocator?

FirstBill wrote the beginnings of it.  It's basically a drop-in
replacement for malloc/calloc/free (really a wrapper around them) that,
when initialized, pre-allocates blocks of various sizes (in FirstBill's,
IIRC, it does as many blocks of a given power-of-two size as will fit in

It uses a simple stack to keep its free lists.  The stack, while simple in
concept, is the tricky-in-implementation part.  The idea is that the stack
API just has three operations: init/push/pop.  That's it.  On many
platforms, a stack like this can be implemented without locks, using
architecture-specific instructions like Compare-Double-and-Swap.

So it's really just a wrapper around malloc that keeps stacks of blocks
that can be very efficiently re-allocated.

That's it.


   Cliff Woolley
   Charlottesville, VA

View raw message