Finalize GC memory
Ali Çehreli
acehreli at yahoo.com
Sun Jun 16 12:24:40 PDT 2013
On 06/15/2013 02:22 PM, Namespace wrote:
> With the knowledge that 'delete' will be deprecated soon:
> Is there then still a way to finalize GC memory? I know it's unsafe etc.
> but is there a way? I know of 'destroy' but it does not finalize
> anything and AFAIK it's not safe and has also side effects.
Being a C++ programmer, I am new to the term "finalize". If it means
"call the destructor", then destroy() is it.
> And it does
> not call the DTor if any struct is allocated with 'new'.
It does:
import std.stdio;
struct S
{
~this()
{
writeln("destructor called");
}
}
void main()
{
auto s = new S();
destroy(*s); // NOTE the '*' operator!
}
> I tried GC.free, GC.collect, destroy and a few other things, but except
> of 'delete' nothing finalize the memory.
> Thoughts?
Ali
More information about the Digitalmars-d-learn
mailing list