std.container.Array/RefCounted(T) leaking memory?

%u wfunction at hotmail.com
Mon Jan 17 17:16:51 PST 2011


> I find it very hard to believe that struct dtors are never called.

Sorry, that part was my bad -- last time I checked, they didn't get called, but
maybe my example was too complicated, since they did get called for a *simple*
example.

However, here's a situation in which no postblit or destructor is called whatsoever:

import std.stdio;
struct S
{
   this(int dummy) { writeln("ctor"); }
   this(this) { writeln("postblit"); }
   ~this() { writeln("dtor"); }
}
S test(int depth) { return depth > 0 ? test(depth - 1) : S(0); }
int main(string[] argv) { test(3); }


More information about the Digitalmars-d-learn mailing list