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
8KB).

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

--------------------------------------------------------------
   Cliff Woolley
   [EMAIL PROTECTED]
   Charlottesville, VA


Reply via email to