$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Achilleas Margaritis (axilmar_at_[hidden])
Date: 2007-09-17 14:31:58
O/H Larry Evans ÎγÏαÏε:
> On 09/17/07 03:30, Achilleas Margaritis wrote:
>> Larry Evans wrote:
>>> On 09/16/07 16:56, Achilleas Margaritis wrote:
> [snip]
>>> How does this collector determine the location of pointers on the stack
>>> and within the heap?
>> An internal bit map is used as a pointer database. Each bit represents
>> one pointer location in memory.
>>
>> When the class gc_ptr<T> is created, the bit that corresponds to the
>> pointer's address is set.
>>
>> When a pointer is destroyed, the same bit is reset.
>>
>> The bitmap is organized in pages of 4K and allocated dynamically.
>>
>> The collector sweeps unused pages at collection time.
>
> So the essential difference from the Boehm conservative collector:
>
> http://www.hpl.hp.com/personal/Hans_Boehm/gc/gcdescr.html
>
> is in the mark phase where, instead of:
>
> Any bit patterns that represent addresses inside heap objects managed
> by the collector are viewed as pointers.
>
> your collector would have:
>
> Any memory location contained in the pointer database must be
> pointer.
>
> Hence, during the scan of memory, if a memory location is in the
> pointer database, that memory location is dereferenced to arrive
> at another memory location which is then marked and then
> the memory from that location to that location + size (where size
> is stored somewhere else) is scanned.
>
> Is that about right?
>
You are correct, but that's not the only difference.
Boehm's gc is about 20,000 lines of code custom-built for each operating
system. Mine's is about 500 lines of portable code, excluding the
examples and dlmalloc, of course.