Hello People I was just trying out custom memory allocation/deallocation that can be found on the link http://www.d-programming-language.org/memory.html#newdelete
The problem is that the delete function is never getting called. I have put an example test case at the end of the email. Any ideas? Regards - Puneet import core.memory : GC; import std.stdio; import std.exception; // enforce class Foo { string value = "."; new(size_t sz) { write("+"); void* p = enforce(GC.malloc(sz), "Out of memory while allocating Foo"); GC.addRange(p, sz); return p; } delete(void* p) { write("-"); if (p) { GC.removeRange(p); GC.free(p); } } } void main() { for (size_t i = 0; i < 32; ++i) { Foo foo = new Foo(); write(foo.value); } }