Don't expect class destructors to be called at all by the GC

DanielG simpletangent at gmail.com
Wed Jan 31 10:14:53 UTC 2018


On Thursday, 21 December 2017 at 18:20:19 UTC, H. S. Teoh wrote:
> I ended up calling .destroy on the class instance explicitly 
> just so the destructor would run at the right time, right 
> before nulling the reference so that the GC would collect the 
> memory.

Pardon my probable ignorance (D newbie and all), but why wouldn't 
a 'delete' work for this?

https://dlang.org/spec/expression.html#delete_expressions


More information about the Digitalmars-d-learn mailing list