Getting completely (I mean ENTIRELY) rid off GC

Andrey Lifanov via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 11 08:23:53 PDT 2014


Thank you for quick response!

I guess I need further investigation and write good tests to 
compare C++ and D solutions. The main advantage over GC-language 
is that in case of manual memory management I know completely 
when and what will be freed or allocated (with the help of smart 
pointers/reference counting, of course). You can say that this 
has no importance to programmer, but it has, because you don't 
have performance spikes and don't have to waste the processor and 
slow memory time for scanning what things need to be collected. 
So, the big advantage (with the price of greater responsibility) 
is much greater predictability of how your program will perform.

The main problem of heap-intensive programs with huge amount of 
objects is heap fragmentation. During the program work there can 
be "holes" of memory chunks which complicate further allocations, 
specially for big continuous arrays. Also it ruins cache 
performance, because similar objects, belonging to one array, can 
be stationed far from each other, divided by such "holes". Fairly 
speaking, C/C++ do not have the built-in solution for such 
problem, but you can program it manually there.

So maybe instead of getting rid of GC I will consider the 
implementation of optimized moving GC.


More information about the Digitalmars-d mailing list