Moving GC

Christopher Wright dhasenan at gmail.com
Sat Dec 13 10:56:03 PST 2008


dsimcha wrote:
> == Quote from Christopher Wright (dhasenan at gmail.com)'s article
>> It means that you can't use one block for objects of multiple types.
> 
> Sure you can, without being any worse off than under the current scheme.  Mark the
> contents of the memory as an array of void*s.  This would have the same effect as
> marking it for GC scanning under the current scheme, basically making the GC scan
> the block conservatively.  Furthermore, if you're storing value types or pointers
> to reference types that also have a pointer stored in a GC-scanned block, set the
> typeinfo to byte or something, and you have the equivalent of setting the NO_SCAN bit.

If you regularly do that, you won't have a moving garbage collector. If 
you do that only when you're low on memory, that might be acceptable.



More information about the Digitalmars-d mailing list