New pointer type for GC

via Digitalmars-d digitalmars-d at puremagic.com
Tue May 27 00:56:54 PDT 2014


On Tuesday, 27 May 2014 at 02:52:48 UTC, Etienne Cimon wrote:
> I've been looking at the GC and found that the main problem is 
> that there's no clear information about the pointers. At least 
> smart pointers have some info inside them but GC pointers are 
> completely plain 4-8 bytes and nothing else.

On 64 bit platform 8 bytes is sufficient if you control the 
allocator:

1. Avoid allocating non-GC memory from specific address range.
2. Set a max-size for GC allocated objects.

Then the test becomes this:

if ((ptr & NONGCMASK)==0){
    heapinfo_ptr = ptr&MASK;

   // process ptr
}


More information about the Digitalmars-d mailing list