
Dear list,
I'm using boost::fast_pool_allocator to replace the default allocator in
a map. This works great, but I'm having a bit of trouble freeing the
memory explicitly.
I'd like to call boost::singleton_pool::purge_memory(), but I don't know
how to instantiate the correct version. Is there a way to determine the
size of the chunks the map allocator will require? I have determined by
debugging that the size is 28 bytes, but I imagine that this is
dependent on the particular implementation of map.
Below is a sample program which illustrates the situation. Any guidance
would be very appreciated.
- Finley
////////////////////////////////////////////////////////////////////////
///
#include
::purge_memory() ;
//bool memory_freed = boost::singleton_pool< boost::fast_pool_allocator_tag, 28 >::purge_memory() ; assert( memory_freed ) ; return 0; }

On 4/19/06, Finley Lee
I'd like to call boost::singleton_pool::purge_memory(), but I don't know how to instantiate the correct version. Is there a way to determine the size of the chunks the map allocator will require? I have determined by debugging that the size is 28 bytes, but I imagine that this is dependent on the particular implementation of map.
Maps have a function for returning copies of their allocators: http://www.roguewave.com/support/docs/sourcepro/edition9/html/stdlibref/map.... HTH, ~ SWMc

On 4/19/06, Finley Lee
I'm using boost::fast_pool_allocator to replace the default allocator in a map. This works great, but I'm having a bit of trouble freeing the memory explicitly.
I posted about his a few months ago and received no reply. I worked around this issue by not using the singleton allocators, but that's hardly a solution. This seems to be an issue with the rebind. You're really looking for boost::singleton_pool< boost::fast_pool_allocator_tag, sizeof( map node ) >::purge_memory(); but I don't think there is a portable way to determine that map node type or size. Michael Fawcett
participants (3)
-
Finley Lee
-
me22
-
Michael Fawcett