GC Sentinel

Steven Schveighoffer schveiguy at yahoo.com
Thu Oct 29 05:35:26 PDT 2009


On Tue, 27 Oct 2009 19:41:24 -0400, dsimcha <dsimcha at yahoo.com> wrote:

> I'm looking at the GC implementation and starting my hacking.  I noticed  
> that
> the ends of blocks are already being used in some creative ways in the
> sentinel version.  This looks like a debugging feature, though I don't
> understand it completely.  Can one of the original implementors (Walter,  
> Sean)
> explain to me what the heck version(SENTINEL) in gcx.d does at a high  
> level,
> whether it conflicts with storing bit masks for precise heap scanning at  
> the
> ends of memory blocks, and whether we still even need it?

IIRC, the sentinel byte is to prevent pointers from leaking into the next  
block.

For example, if you did:

byte[] x = new byte[16]; // GC allocates 16 byte block.
x = x[$..$];

Now, if there is no sentinel byte, the pointer in x points to the *next*  
memory block.

It is an interesting problem, there might be a better solution.

-Steve



More information about the Digitalmars-d mailing list