Linus with some good observations on garbage collection

bearophile bearophileHUGS at lycos.com
Fri Apr 22 14:21:45 PDT 2011


Timon Gehr:

> But, as pointed out by Linus, the prime performance problem is _not_ the GC, but
> the mindset that comes with it. Most programmers that "grew up" in a managed
> environment tend to use very many "new" keywords all over their code, instead of
> allocating large chunks of memory at once. (Java/C#/etc encourage you to do this.)

In C99 (and Ada) you avoid the allocation of some dynamic arrays with new thanks to variable length arrays.


> This is also the reason I think it is a bad idea to deprecate D's 'delete'.

D used to have scoped class instances, scoped classes, and delete, their replacements are not good enough yet. In CommonLisp you have hints for the GC, they are safe and they help you help speedup the work of the GC. Such hints probably need to be integrated with the type system, so they may need to be built-ins as scope/delete were. I am not seeing enough discussion about this.

Bye,
bearophile


More information about the Digitalmars-d mailing list