|
Boost Users : |
Subject: Re: [Boost-users] custom allocators Re:pool_alloc
From: B Hart (bhartsb_at_[hidden])
Date: 2010-03-17 16:47:45
Ok understood, but ?s:
1. when the set goes out of scope does the instance of the class get
destroyed? As I understand, singleton only guarantees that there is
one instance, so the implementation semantics could vary. e.g. the
singleton is more like a class factory guaranteeing 1 instance.
2. When the set goes out of scope is any memory released? Setting
the node to it's internal node type sort of implies that the memory
has been released already.
3. "the allocator actually used by the set is using a different underlying
pool than v"...what do you mean??? there are two pools. I'm getting confused.
On Wed, Mar 17, 2010 at 1:27 PM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> AMDG
>
> 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. Therefore what is the purpose of
>> release_memory()...maybe I don't understand pool. And then "internal
>> node type"...what is that?
>>
>
> Set is implemented using a binary search tree. set<int>
> doesn't actually allocate ints, it allocates a struct that probably
> looks something like:
>
> struct Node {
> int value;
> int color;
> Node * left;
> Node * right;
> Nonde * parent;
> };
>
> pool_allocator uses separate singleton pools for
> each size of element that it needs to handle.
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> 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