purge_memory of fast_pool_allocator's singleton pool

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

purge_memory of fast_pool_allocator's singleton pool

Michael Fawcett
Is there a way to purge the memory of the underlying singleton_pool
used by a specific fast_pool_allocator?  For example:

typedef boost::fast_pool_allocator
<
        std::pair<const int, astar_node *>,
        boost::default_user_allocator_new_delete,
        boost::details::pool::null_mutex
> my_allocator;
typedef std::map<int, astar_node *, std::less<int>, my_allocator> MyMap;

// ...do lots of allocations

// I don't care about destructors being called, just release ALL memory
if (boost::singleton_pool
        <
                boost::fast_pool_allocator_tag,
                sizeof(my_allocator::value_type),
                my_allocator::user_allocator,
                my_allocator::mutex,
                my_allocator::next_size
        >::purge_memory() == false)
{
        std::cout << "Failed to purge the fast_pool!!" << std::endl;
}

This always prints the error message for me.  I suspect it has
something to do with map's allocator rebinding to allocate map nodes,
but I'm not sure how to solve this.

Any help would be appreciated.
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users