Tony:
> Walter Bright:
> > 1. GC programs can be faster
> > 2. GC programs can use less memory
> > 3. GC programs can be guaranteed to be memory safe
> > 4. GC programs are faster to develop and have fewer bugs
> 
> None of which "sell me" on GC.

Generally a program that uses GC uses more RAM (2-12 times) than a manually 
memory managed one. I have also read various articles that say the same thing. 

They also say that GC-managed programs can be almost as fast as manually 
managed ones only of you give them 2-6 the RAM you give un-GC-managed ones.

It can be right only if you count memory leaks too: they make programs that 
manage memory manually to use unbound amounts of memory. On the other hand a GC 
doesn't prevents you all memory leaks, because you can leave around references, 
etc.

So even taking into account that Walter's experience on such topics is far 
greater than mine (I've never written a GC for C++, for example), I'd risk say 
that in general point 2 is wrong.
Said that, most of the times using a GC is better (especially if you use a 
modern GC, like the HotSpot one, etc), and often today RAM isn't a scarce 
resource anymore, so I like D to have a built-in GC activated by default, plus 
a C heap to manage things manually :-)

Bye,
bearophile

Reply via email to