-nogc

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Apr 23 04:40:16 PDT 2009


Christopher Wright wrote:
> 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.

It just means that certain types and constructs are rewritten. The exact 
strategy depends on how Ref, Array, and AssocArray are defined.

Probably a good approach is to simply rewrite anything anyway and have 
Ref vanish in gc mode by means of e.g. alias this.

So this means that we only need a flag -object=/path/to/object.d after all.


Andrei



More information about the Digitalmars-d mailing list