Boost logo

Boost :

Subject: Re: [boost] [pool] Definition of a static_pool ?
From: Christopher Kormanyos (e_float_at_[hidden])
Date: 2012-04-25 17:38:57


>> The Boost.Pool class describes a pool of buffer, pool whose size grows as needed.

>>
>> This is very convenient but there usage cases where the pool should not perform any dynamic memory
>> allocation, i.e. the maximum number of simultaneously required buffers is known at initialization.
>>I have
>> hence defined a simple class 'static_pool' (see below), which
>> (i) allocate all requested buffers at initialization;
>> (ii) fails (returns null) if more buffers are being asked for at runtime.
>>
>> Does such a class has its place within the Boost Pool library ?

Paul A. Bristow wrote:
> I'm sure that there is some user for this (though unclear how popular or advantageous it would be -
> perhaps others can comment on this?).

I also need entirely static pools that allocate memory at *compile* time via template parameter.
I use this kind of pool as the basis for memory allocation in embedded microcontroller projects.

So I would actually need one-shot allocation (as you describe) as well as compile-time allocation.

I have always written my own pools for this. I might be nice to get one *off the rack* from boost.

Good luck.

Best regards, Chris.


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