Why does D rely on a GC?
Nick Treleaven via Digitalmars-d
digitalmars-d at puremagic.com
Mon Aug 18 08:49:20 PDT 2014
On 18/08/2014 13:27, Maik Klein wrote:
> If I do something like:
>
> auto ptr = Unique(Foo);
>
> Would the GC still be used, or would the resource be freed by the
> destructor?
It uses GC allocation, but the memory will be freed deterministically:
{
Unique!Foo u = new Foo;
// u's destructor will call 'delete' on its instance of Foo here
}
More information about the Digitalmars-d
mailing list