
nope, continued upwards and release_memory() always returns false. Also, I would say that release_memory is broken, or needing revision, if one has to guess what the pool size is. On Thu, Mar 18, 2010 at 7:14 AM, Steven Watanabe <watanabesj@gmail.com> wrote:
AMDG
B Hart wrote:
I tried contacting Stephen the pool_allocator author, but his e-mail is invalid (shouldn't the docs be updated?)
Here is what I wrote in case someone else here can offer some help:
I'm trying unsuccessfully to use your Boost::pool_alloc. In the documentation at the boost website: http://www.boost.org/doc/libs/1_42_0/libs/pool/doc/interfaces.html it says:
// Exiting the function does NOT free the system memory allocated by the pool allocator // You must call // boost::singleton_pool<boost::pool_allocator_tag, sizeof(int)>::release_memory() // in order to force that
release_memory() does not seem to work. Not sure why. I called a function in my code to verify my processes memory usage, and see that indeed memory was not being released. I also google searched and found that others experienced the same:
The problem is not release_memory per se. The problem is the interaction between singleton_pool, pool_allocator and std::set. The example is using vector, which (probably) allocates exactly the type that you give it. std::set is allocating a different type. pool_allocator uses multiple singleton_pools, one for each size of object. release_memory would work if you could find the size of the object that std::set is actually allocating. Without knowing that, the best you can do is something like
// assume that the sizes are multiples of 4 bytes. boost::singleton_pool<boost::pool_allocator_tag, 4>::release_memory(); boost::singleton_pool<boost::pool_allocator_tag, 8>::release_memory(); boost::singleton_pool<boost::pool_allocator_tag, 12>::release_memory(); boost::singleton_pool<boost::pool_allocator_tag, 16>::release_memory(); boost::singleton_pool<boost::pool_allocator_tag, 20>::release_memory(); boost::singleton_pool<boost::pool_allocator_tag, 24>::release_memory(); boost::singleton_pool<boost::pool_allocator_tag, 28>::release_memory(); boost::singleton_pool<boost::pool_allocator_tag, 32>::release_memory(); // hope that's enough...
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users