> class A > { > bool reset; > void delegate dtor(); > ~this() > { > if (!reset) > dtor(); > } > } > > class B > { > A a; > bool run; > ~this() { if (!run) a.reset = true; run = true; } > } > > A a = new A; > B b = new B; > b.a = a; > b.a.dtor = & b.__dtor; relying on to "bool reset" it's no good idea. In this case a manual memory management - good choice.