Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::pool memory question
From: Boris Schaeling (boris_at_[hidden])
Date: 2012-08-21 19:41:12


On Tue, 21 Aug 2012 22:55:27 +0200, Claude <clros_at_[hidden]> wrote:

>> In email, your valgrind output does not show up. Perhaps because it
>> is not plain text? Everything shows up fine in the web thread.
>
> Opss, excuse me!
>
> This is the simple program:
>
> #include <iostream>
> #include <vector>
> #include <boost/pool/pool_alloc.hpp>
>
> using namespace std;
>
> int main()
> {
> std::vector<int,boost::pool_allocator&lt;int>> myVector;
>
> for (int64_t i = 0; i < 150000; ++i)
> myVector.push_back(13);
>
> boost::singleton_pool<boost::pool_allocator_tag,
> sizeof(int)>::release_memory();
> return 0;
> }
>
>
> and this is the valgring output:

Not sure what you are wondering about. But maybe this note from
<http://www.boost.org/doc/libs/1_51_0/libs/pool/doc/html/boost/singleton_pool.html>
helps:

The underlying pool constructed by the singleton is never freed. This
means that memory allocated by a singleton_pool can be still used after
main() has completed, but may mean that some memory checking programs will
complain about leaks from singleton_pool.

Boris

> [...]


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