apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <bp...@pacbell.net>
Subject Re: [PATCH] First cut at factoring out the pools allocator
Date Sat, 09 Mar 2002 19:56:29 GMT
Sander Striker wrote:

>Below a patch to apr and a patch to httpd
>to factor out the allocator from pools.  It
>is only the first cut, so crucial details
>like documentation are missing.
>I'd like some feedback on the general idea
>Hopefully this helps when implementing the
>bucket allocator.

The only additional thing that I think this API
needs is a way to say "give me a block in which
the total size--including all of the allocator's
internal block header structures--is X."

The idea here is to allow things like the bucket
freelist code to alloc:
  8KB - sizeof(allocator headers)
so that the entire structure fits in two memory

The API could look something like this:

APR_DECLARE(apr_memnode_t *) apr_allocator_alloc2(apr_allocator_t 
                                                  apr_size_t target_size,
                                                  apr_size_t *actual_size);

where "target_size" is an upper bound on the number
of bytes you want and "actual_size" is how many bytes
you actually get to work with (equal to target_size
minus the space devoted to the allocator's internal
block header structs).


View raw message