Boost logo

Boost :

From: Michael Gopshtein (mgopshtein_at_[hidden])
Date: 2007-05-08 14:19:13

"Dean Michael Berris" <mikhailberis_at_[hidden]> wrote in message
> On 5/7/07, Michael Gopshtein <mgopshtein_at_[hidden]> wrote:
>> As a solution I was thinking about adding a "defragment" function to
>> memory
>> pool, which will compact it by moving live objects to free cells at the
>> "beginning" of the pool. Such feature can be implemented with help of
>> additional "index" table of pointers. Of cause, instead of returning
>> pointer
>> to allocated object, the pool will return a wrapper object, actually
>> pointing to that index table (for which separate "classical" pool can be
>> used).
> Maybe you're looking for the "release_memory" method in the pool
> interface. If you're using the pool_allocator as a replacement to the
> standard allocators, it might be interesting to note that the
> documentation mentions how to use "release_memory":
> ...

release_memory: "Frees every memory block that doesn't have any allocated

This might be useful, I agree. And the chances to get such free blocks can
be improved by using smaller block size, although it's hard for me to
predict what can be the ratio of "free" blocks, even if total number of
objects is relatively small.

> Hope this helps.
> --
> Dean Michael C. Berris
> mikhailberis AT gmail DOT com
> +63 928 7291459
> _______________________________________________
> Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at