Boost logo

Boost Users :

Subject: Re: [Boost-users] custom allocators Re:pool_alloc
From: B Hart (bhartsb_at_[hidden])
Date: 2010-03-17 16:52:43


I'm understanding that it is not allocating unsigned ints and instead
creating a node structure wherein uint is a subelement. The nodes are
needed because set is internally kept as a tree structure. What I'm
not understanding is when is the memory released? and when is the
instance of the set destroyed?

On Wed, Mar 17, 2010 at 1:27 PM, Kenny Riddile <kfriddile_at_[hidden]> wrote:
> B Hart wrote:
>>
>> Sorry, I don't get you...as I understand the pool is a singleton, and
>> once out of scope I would assume all the memory for the set is
>> released back to the OS.
>
> If you mean when the std::set goes out of scope, then no.
>
>> And then "internal node type"...what is that?
>
> Some STL containers (std::list, std::set, etc.) don't directly store
> elements of the type you specify.  For example, a std::list would likely
> store list nodes that contain the data element itself as well as pointers to
> the previous and next nodes.  In that case, a std::list< Foo,
> boost::pool_allocator<Foo> > doesn't allocate via
> boost::singleton_pool<boost::pool_allocator_tag, sizeof(Foo)>.  It allocates
> via boost::singleton_pool<boost::pool_allocator_tag,
> sizeof(SomeUnknownInternalNodeType)>.
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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