-nogc

Brad Roberts braddr at puremagic.com
Thu Apr 23 10:39:07 PDT 2009


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.

Later,
Brad



More information about the Digitalmars-d mailing list