You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Brian Pane <bp...@pacbell.net> on 2002/03/30 08:05:16 UTC

[PATCH] bucket alloc: a simpler approach

While prototyping an apr_allocator_t based implementation for the
bucket allocator, I suddenly realized that there may be a much simpler
way to solve the problem.

The attached implementation handles allocation requests differently
based on their size:

  * Anything <= 128 bytes is allocated from a free list of 128-byte
    blocks contained within the bucket allocator.  When the free list
    runs out of blocks, the bucket allocator gets additional memory
    from its pool.  (We can do this because the allocator's lifetime
    is the same as that of the pool from which it was created.)

  * Anything > 128 bytes is handled using malloc/free.  The only
    common case larger than 128 is 8192.  It would be easy to add
    a second free list within the allocator for 8192-byte blocks.
    For this free list, we should probably impose a max size, so
    that we never store more than two or three 8KB blocks in an
    allocator.

Comments...?

--Brian