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
news:6adba9f0705080520h27fcf20coc6b353141e18e8f8_at_mail.gmail.com...
> 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":
>
> http://boost.org/libs/pool/doc/interfaces.html
>
> ...

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

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
> http://cplusplus-soup.blogspot.com/
> mikhailberis AT gmail DOT com
> +63 928 7291459
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk