New pointer type for GC

Etienne via Digitalmars-d digitalmars-d at puremagic.com
Tue May 27 06:58:24 PDT 2014


On 2014-05-27 3:56 AM, "Ola Fosheim Grøstad" 
<ola.fosheim.grostad+dlang at gmail.com>" wrote:
> 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
> }

That's true, though you still need the thread ID for references to 
pointers and you need to be able to pass those pointers to C.

If that's done manually, you end up sanitizing the pointers too often, 
it becomes boilerplate.


More information about the Digitalmars-d mailing list