Boost logo

Boost :

Subject: Re: [boost] [pool] Improvements to boost.pool
From: Boris Schaeling (boris_at_[hidden])
Date: 2012-06-17 07:51:14


On Wed, 16 May 2012 12:42:46 +0200, DUPUIS Etienne <e.dupuis_at_[hidden]>
wrote:

> Greetings,
>
> In the boost sandbox, under the /pool folder, I have committed a few
> small improvements and a few fixes for open tickets. Here is what I have
> changed :
>
> 1. I added boost::static_pool, a pool whose maximum size is known when
> initializing the pool; in which case all memory is allocated when
> calling the constructor. This is useful for software that must manage
> memory with great care. The implementation is a simple subclass of
> boost::pool. In the same vein, I also added boost::static_object_pool.
>
> 2. I also added boost::array_pool, a pool whose maximum size is known at
> compile time. The array_pool object hence already contains all memory it
> needs. Same for boost::array_object_pool. I am not sure that this is
> really useful and I am not sure I have picked a good name for it.

First thanks for working on Boost.Pool at all! That library really
deserves some improvements. :)

I'm not sure whether it makes sense though to introduce more pool classes
if the algorithm to calculate the next chunk size is hardcoded into those
classes again. If the existing classes in Boost.Pool would support a
policy class, we could do everything what you described above without
adding new classes? And if I wanted I could plug-in my own policy class if
for whatever reason I want the sizes of all chunks to be prime numbers for
example. I'm not a big fan of policy classes. But in this case it looks
like it could be a really simple one. I think we need only one member
function which returns the next size. Without that flexibility I (as a
library user) either have to change code in Boost.Pool or open a ticket
and propose boost::prime_numbers_pool to be added. ;)

Boris

> [...]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk