On Saturday, 30 January 2016 at 05:50:33 UTC, Dsby wrote:
Ok.Thank you.
and i want to know how to know when the GC start runing?
See also http://dlang.org/phobos/core_memory
On Saturday, 30 January 2016 at 05:50:33 UTC, Dsby wrote:
Ok.Thank you.
and i want to know how to know when the GC start runing?
For the current implementation, any time you allocate memory
through the GC it will determine if a collection cycle is needed,
but it will not run otherwise.
Ok.Thank you.
and i want to know how to know when the GC start runing?
On Friday, 29 January 2016 at 13:22:07 UTC, Mike Parker wrote:
Your problem is probably that you are calling GC.free in the
destructor. Don't do this. You don't need to call GC.free at
all. The GC will collect both your object instance and the
memory you allocated with new. Never, ever, manipu
On Friday, 29 January 2016 at 12:43:53 UTC, Dsby wrote:
the Code:
~this(){
GC.free(by.ptr);
by = null;
writeln("free");
}
Your problem is probably that you are calling GC.free in the
destructor. Don't do this. You don't need to
On Friday, 29 January 2016 at 12:43:53 UTC, Dsby wrote:
the Code:
class MyClass
{
this(){
by = new ubyte[1];
++i;
}
~this(){
GC.free(by.ptr);
by = null;
writeln("free");
}
v
the Code:
class MyClass
{
this(){
by = new ubyte[1];
++i;
}
~this(){
GC.free(by.ptr);
by = null;
writeln("free");
}
void show(){
writeln(i);
};
privat