[Gc] Re: A technical question (and maybe a proposal)

Achilleas Margaritis axilmar at otenet.gr
Sun Dec 23 02:48:23 PST 2007

Ok, here is another one:

You mention in the docs that before a collection, the mark bits are 
cleared. Is there one bit per memory block? does this mean that at every 
collection, if there are N blocks, N bits must be cleared?

If so, then I propose you use a flag which indicates the cycle 
(odd/even) that the collector is in. When you mark a block, you set its 
flag to the current cycle, and when you sweep objects, you check block 
flags against the cycle: if a block's flag has different value from the 
cycle flag, then the object has not been marked.

O/H Boehm, Hans έγραψε:
>> From:  Achilleas Margaritis
>> I have a question regarding the internals of the gc:
>> Are blocks of the same size allocated from the same page? if
>> not, then that's my proposal. Allocating same-sized chunks
>> from the same page would make locating block headers very
>> fast: all that it takes is to divide the page offset by the
>> block size to find the block start.
> That is essentially what's done, except that there are actually no block headers for in-use blocks, and in some configurations the division is further replaced by a table lookup.
> There is a slightly dated description of the GC implementation at https://www.hpl.hp.com/personal/Hans_Boehm/gc/gcdescr.html and https://www.hpl.hp.com/personal/Hans_Boehm/gc/tree.html.
> Hans
>> _______________________________________________
>> Gc mailing list
>> Gc at linux.hpl.hp.com
>> https://www.hpl.hp.com/hosted/linux/mail-archives/gc/

More information about the Gc mailing list