Moving GC

Don nospam at
Sat Dec 13 11:22:23 PST 2008

Sean Kelly wrote:
> dsimcha wrote:
>> What are the odds that some D implementation gets a moving GC in the
>> foreseeable future?
> Minuscule.  The GC isn't provided nearly enough type information to 
> safely move memory right now, and I don't see that changing any time soon.
> Sean

An related case that could probably be done is pure functions. Inside a 
pure function, all allocations could be made on a 'pure heap' instead of 
the normal heap. When returning from a pure function back into a 
non-pure function, copy the return value into the normal heap (moving it 
in the process). Then discard the entire pure heap.
(This is a *huge* win if the return value from the pure function is a 
POD, and the pure function does extensive memory allocation).

Of course, that's more like a memory pool rather a gc.

More information about the Digitalmars-d mailing list