[RFC]Proposal for better garbage collection

Martin Nowak dawg at dawgfoto.de
Wed Feb 22 20:07:13 PST 2012


> 4) Thread local / global memory
>
> A callback into the runtime needs to happen in the following cases:
> - a __gshared variable is assigned
> - a reference / pointer is casted to immutable
> - a reference / pointer is casted to shared
>
> void _d_castToGlobalMem(void* ptr);
>
> This can be used by the GC to keep thread local pools of memory and move  
> a memory block to a global memory pool as soon as it is needed there.
>
If we'd want per-thread mark/sweeping then shared memory must never own
unshared memory. I think this could be done using a separate allocator for
shared/immutable data. For casts this would require a transitive move of  
the
data or it'd need to be prohibited.


More information about the Digitalmars-d mailing list