Boost logo

Boost Users :

Subject: [Boost-users] does pool::release_memory() really require an ordered pool?
From: Mark Rajcok (mrajcok_at_[hidden])
Date: 2010-09-01 17:32:46


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
lot of memory, but then later (after spiking) I'd like to release it.
(The object pools will persist for the life of the application, and
there will probably always be some "active objects" -- i.e., allocated
from the pool and not free()d yet.)

(I'm hoping the documentation may be out of date, and release_memory()
can be used on pools that don't use ordered_malloc() and on
object_pools.)

-- Mark


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net