Finalize GC memory
Namespace
rswhite4 at googlemail.com
Sun Jun 16 14:14:52 PDT 2013
> Being a C++ programmer, I am new to the term "finalize". If it
> means "call the destructor", then destroy() is it.
Finalize -> free the memory immediately as 'delete' it does
currently.
> > 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!
> }
Good to know!
More information about the Digitalmars-d-learn
mailing list