Garbage Collector

thedeemon via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 16 20:39:55 PDT 2016


On Wednesday, 15 June 2016 at 13:19:31 UTC, Konstantin wrote:

> Has anyone thought about taking GC from .NET and reusing it in 
> D?

One significant point has been already mentioned: cost of write 
barriers.
I'd like to mention another factor: .NET GC is a copying one, it 
moves data around. One good feature of current D is it never 
moves data, so you can very easily call C and C++ code and pass 
pointers to your buffers and stuff and C/C++ code just takes 
these pointers and works with them as usual. No pinning, no 
marshaling, zero overhead. If you take a moving GC like .NET's, 
you immediately make all C/C++ interaction much harder, now you 
need to worry about pinning stuff or copying "managed" data to 
"unmanaged" memory and back. This is all costly both in terms of 
CPU cycles and of programmer cycles. You'll need "FFI", what most 
other GC-ed languages have to have, and D doesn't.


More information about the Digitalmars-d mailing list