
Zitat von Mark Rajcok
On page http://www.boost.org/doc/libs/1_44_0/libs/pool/doc/interfaces/pool.html there is this precondition for release_memory(): "t must be ordered".
Does that mean that ordered_malloc() must always be used, if I want to use release_memory()?
Looking at the implementation for release_memory(), it appears to be iterating through chunks in each block, which I wouldn't expect if ordered_malloc() were always used.
What I'm really after: I want to use object_pool, but periodically I'd like to reclaim/release any memory blocks that are no longer in use. In my application, I may have traffic spikes, where I allocate a
object pools as defined by Boost.Pool must use ordered_malloc anyway, because your objects might have destructors and only an ordered pool can find the allocated objects in case the pool is destructed (e.g. on exception). if you need to free many pool objects (but not the entire pool) I'd recommend not using Boost.Pool at all. ordered_free has a runtime complexity linear to the size of the free list. I think Boost.Pool is outdated and Boost.Pool2 might be a good GSOC project. is anyone maintaining a list? in the meantime, I'd recommend building your own pool for this use case using Boost.Intrusive containers.