Boost logo

Boost Users :

Subject: Re: [Boost-users] custom allocators Re:pool_alloc
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-03-17 16:27:48


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 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