Boost logo

Boost Users :

Subject: Re: [Boost-users] custom allocators, pool_alloc release_memory() seems to be broken
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-03-18 18:23:13


AMDG

B Hart wrote:
> nope, continued upwards and release_memory() always returns false.
>

I stepped though

#include <boost/pool/pool_alloc.hpp>
#include <set>

int main() {
    {
        std::set<int, std::less<int>, boost::pool_allocator<int> > s;
        for(int i = 0; i < 100; ++i) {
            s.insert(i);
        }
    }
    boost::singleton_pool<boost::pool_allocator_tag, 20>::release_memory();
}

and the call to release memory does seem to work.

> Also, I would say that release_memory is broken, or needing revision,
> if one has to guess what the pool size is.
>

It isn't broken. release_memory works fine if you can
find the right pool. Because std::set does not expose the type
that it actually allocates there is no portable way to do so.

In Christ,
Steven Watanabe


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