On Monday, 20 April 2015 at 02:56:35 UTC, Ali Çehreli wrote:
Not automatically. Check out addRange and addRoot:http://dlang.org/phobos/core_memory.html Ali
The destructor doesn't seem to be running
----
import std.stdio;
import std.c.stdlib;
import core.memory;
struct Test{
~this(){
writeln("free: ",&this);
free(&this);
}
}
void main(){
auto ptr=cast(Test*)malloc(4);
writeln("create: ",ptr);
GC.addRange(ptr,0,typeid(Test));
ptr=null;
GC.collect();
}
----
$ rdmd test
create: 1EEC730
