GC vs. Manual Memory Management Real World Comparison

bearophile bearophileHUGS at lycos.com
Wed Sep 5 08:59:43 PDT 2012


Iain Buclaw:

> I think it was mostly due to that you can't tell the difference
> between array literals that are to be assigned to either 
> dynamic or static arrays (as far as I can tell).

I see.


> I do believe that the issues
> surrounded dynamic arrays causing SEGVs, and not static  (I 
> don't recall ever needing the use of a static array :-).

I use fixed size arrays all the time in D. Heap-allocated arrays 
are overused in D. They produce garbage and in lot of cases they 
are not needed. Using them a lot is sometimes a bad habit (if you 
are writing script-like programs they are OK), that's also 
encouraged by making them almost second-class citizens in Phobos 
(and druntime, using them as AA keys causes performance troubles).

If you take a look at Ada language you see how much 
static/stack-allocated arrays are used. In high performance code 
they help, and I'd like D programmers and Phobos devs to give 
them a little more consideration.

Bye,
bearophile


More information about the Digitalmars-d-announce mailing list