Andrei Alexandrescu wrote:
I've discussed something with Walter today and thought I'd share it here.
The possibility of using D without a garbage collector was always
looming and has been used to placate naysayers ("you can call malloc if
you want" etc.) but that opportunity has not been realized in a seamless
manner. As soon as you concatenate arrays, add to a hash, or create an
object, you will call into the GC.
So I'm thinking there should be a flag -nogc that enables a different
model of memory allocation. Here's the steps we need to take:
This means replacing a mark/sweep GC with a reference counting GC. I'd
think that it would be better to have -nogc not use Ref(T) by default,
and add another flag -refcount that implies -nogc and uses Ref(T) by
default.