Boost logo

Boost Users :

Subject: Re: [Boost-users] fast_pool_allocator question
From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2008-10-07 12:20:47


On Tue, Oct 7, 2008 at 12:58 AM, Ta-Cheng Lin <tclin1998_at_[hidden]> wrote:
> Hi:
>
> I try fast_pool_allocator and it does not release memory. See the following
> program
> Any ideas?

<snip code>

Well, this issue has come up before. I can tell you the reason, but I
can't remember the solution.

The reason is that the singleton instance you are calling
release_memory() on is not the singleton the list is using to allocate
nodes. Remember that std::list<int> will rebind the allocator to
allocate SomeNodeStruct<int> instead of plain ints. As far as I know,
there is not a portable way to get the type of "SomeNodeStruct".

HTH,

--Michael Fawcett


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