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

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Tue Jan 18 02:24:11 PST 2011


On Tue, 18 Jan 2011 01:16:51 +0000, %u wrote:

>> 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); }


That would be bug 3516, wouldn't it?

  http://d.puremagic.com/issues/show_bug.cgi?id=3516

-Lars


More information about the Digitalmars-d-learn mailing list