-nogc

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Apr 23 10:48:37 PDT 2009


Brad Roberts wrote:
> Leandro Lucarella wrote:
> 
>> Now in Tango/Druntime you already can use a dummy GC that all it does is
>> calling C malloc/free for gc_malloc/gc_free, exactly for this purpose, so
>> what -nogc should do in that case is just link against the "stub" GC
>> instead to the "basic".
> 
> This claim really needs to stop.  You can't just swap from the normal gc
> to the stub gc an expect your app to use malloc/free and behave exactly
> as it did before.  No, it'll leak.  Free will never be called (outside
> the rare case of an explicit delete).  Normal apps expect implicit
> cleanup to be invoked by the gc which will never happen in the stub.
> That's fine in tiny apps, or apps that carefully manage their own
> memory, but then you weren't using the gc in the first place for those apps.

Totally agreed. I've always wondered what the purpose of the stub GC was 
in druntime. "We can implement an appallingly crappy allocation model" 
is the only message I'm getting.

Andrei



More information about the Digitalmars-d mailing list