fast_pool_allocator, std::multi_map and purge_memory

Hi,
I have written a small test program to measure the performance
benefit of using a boost::fast_pool_allocator vs the default system
allocator in conjunction with a std::multi_map. Memory overhead is
~16% lower and the boost allocator is ~4x faster - sweet. However, I
can't release the allocated memory via the singleton_pool interface
as described in the documentation.
In my test program quoted below the call to purge_memory always
returns 0 and according to window's task manager the memory has not
been released. An even simpler test just using an allocator for ints
and allocating/relasing/purging 10.000.000 ints works as expected.
What am I doing wrong?
cheers,
Sören
PS: I'm using boost 1.39 with MSVC2008
#include <map>
#include <iostream>
#include

AMDG Soeren Meyer-Eppler wrote:
I have written a small test program to measure the performance benefit of using a boost::fast_pool_allocator vs the default system allocator in conjunction with a std::multi_map. Memory overhead is ~16% lower and the boost allocator is ~4x faster - sweet. However, I can't release the allocated memory via the singleton_pool interface as described in the documentation.
In my test program quoted below the call to purge_memory always returns 0 and according to window's task manager the memory has not been released. An even simpler test just using an allocator for ints and allocating/relasing/purging 10.000.000 ints works as expected. What am I doing wrong?
std::multi_map doesn't allocate object of the value_type. It uses Allocator::rebind to allocate objects of its internal node type, which contains extra member. In Christ, Steven Watanabe

std::multi_map doesn't allocate object of the value_type. It uses Allocator::rebind to allocate objects of its internal node type, which contains extra member.
Thanks for the quick reply Steven. Your explanation makes perfect sense - however it also presents a problem: how do I deallocate memory now? As far as I can tell the STL that ships with MSVC has the map's internal _Node datatype protected. So aside from guessing the correct size of it - how can I tell what the proper singleton pool is? cheers, Sören
participants (2)
-
Soeren Meyer-Eppler
-
Steven Watanabe