Boost logo

Boost Users :

From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2006-03-16 17:54:42


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 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