Garbage Collector

rikki cattermole via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 15 06:40:11 PDT 2016


On 16/06/2016 1:33 AM, rikki cattermole wrote:
> I'm not sure how much you know about D but:
>
> 1. Somebody is working on improving D's GC as part of GSOC in the hopes
> of making it able to be precise (from memory not 100% sure).
> 2. Only a few language features forces you to use the GC.
> 3. For most uses you are not forced to use the GC in any form especially
> with the help of std.experimental.allocator.
> 4. Our GC is based upon the Boehm GC. Its old. Even the more recent
> versions would be far better then what we have (we forked a long time ago).
> 5. The requirements for our GC is quite intricate. I.e. you can't just
> pop in one that doesn't understand about our Thread Local Storage (TLS)
> and stuff.
> 6. As said by somebody else we can disable the GC so it won't go ahead
> and scan upon allocation (only time it does).

I forgot to mention, good D code is not the same as a higher level 
language like Java.

Here you don't have the automagick behavior of arrays. If you append it 
will have a high cost. All allocations have a large cost. Instead 
allocate in one large block which will of course be a whole lot faster 
then small tiny ones.

So even if the GC is enabled, good D code won't cause too much slow down 
unless you decide to write heavy OOP code.


More information about the Digitalmars-d mailing list