Boost logo

Boost :

Subject: Re: [boost] request for interest in a garbage collection library
From: Achilleas Margaritis (axilmar_at_[hidden])
Date: 2009-04-21 16:58:26


joaquin_at_[hidden] wrote:
> Achilleas Margaritis escribió:
>>> AFAICS, you can have an implementation of delete where "delete p"
>>> simply calls the destructor of the object pointed to by p and then
>>> passes p to
>>> an internal garbage collector that will reclaim the memory in due time.
>>> This way you have determinstic resource liberation *and* GC speed.
>>>
>>
>> If you do that, what is the point of keeping the memory occupied by
>> 'p' around? the object will be destroyed anyway and therefore it will
>> not be of any use.
>>
>
> The point is that deferring memory release to the next GC round can be
> faster than
> releasing every little piece of memory immediately, at least in some
> scenarios:
>
> http://www.hpl.hp.com/personal/Hans_Boehm/gc/#details
>
> Take into acount that free(x) is by no means free in terms of execution
> time (no pun intended)
> --some bookkeeping has to be done by the internal memory manager when
> freeing a
> block of memory.

This is valid for Boehm gc only, because the Boehm gc releases whole
pages at a time.

Using a boost pool is a very good solution and is quite fast, on par
with Boehm gc.


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