if d-tor is called, does it means the object is gc-ed?

%u no at where.com
Thu Oct 5 12:13:08 PDT 2006

Sorry for the stupid question, but I'm puzzled.

I have some code like this:

class A {

~this() {


And I created lots of A's.  At some point in my program I explicitly did:
delete a;  for all the a's.

And the printed msg shows the d-tor is called.  But From the system monitor, I
didn't see the memory usage is decreased.  So I wonder whether the memory is
actually freed.

BTW, is there other way I can enforce memory free-ing?

I think the std.gc module should also provide some APIs like

ulong std.gc.allocatedMemory();  // in bytes
ulong std.gc.availableMemory();

So we can monitor the memory usage within the program itself.

More information about the Digitalmars-d-learn mailing list