Boost logo

Boost :

Subject: Re: [boost] [pool2] Requests for comment
From: Cory Nelson (phrosty_at_[hidden])
Date: 2012-10-16 10:28:12

On Tue, Oct 9, 2012 at 2:32 AM, DUPUIS Etienne <e.dupuis_at_[hidden]> wrote:

> Greetings,
> I am currently working on a replacement for boost ::pool. I have a few
> questions regarding what would be an ideal implementation. Hopefully some
> members of the Boost mailing list will be able to help me answering these
> questions. The first question requires to look at the source code; my other
> questions are more general.

Great job! Maybe I can stop implementing my own pools soon. Some feature
requests, if I may:

- An arena allocator: to allocate any-sized objects from, but only
deallocate all at once.

- Allow an arena/pool allocator to draw its storage from another pool.

- Configurable allocation efficiency. For instance, boost::pool will find
the least common multiple of page size and block size, which can result in
huge allocations in the name of not wasting any memory. Sometimes I might
want this, other times I'd be OK wasting a handful of bytes out of every
page if it means more reasonably sized initial allocations.

- Configurable alignment. Very useful for eg. AVX instructions, which can
require 32-byte data alignment.

- (Maybe) If you've got an object allocator, have a policy setting that
disables calling destructors. Not sure if this belongs in the library due
to shooting-own-foot-off potential, but there have been instances where I
don't care about destructors because I know all the resources are
associated with the pool. In this case an object allocator would become a
glorified wrapper for placement new.

Cory Nelson

Boost list run by bdawes at, gregod at, cpdaniel at, john at