Struct destructors not always called?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at
Sun Dec 27 11:09:59 PST 2015

On Sunday, 27 December 2015 at 19:04:11 UTC, Jeremy DeHaan wrote:
> So are these left dangling or do they actually get cleaned up 
> at the program exit?

They are left dangling right now. You can clear it yourself by 
defining a `static ~this() { .destroy(your struct); }` somewhere 
in the module.

Maybe that should be done automatically but right now the 
assumption is those global structs are still available in the 
static dtors so they are considered alive right up to the program 
actually exiting... at which point no more code can run since the 
process has terminated....

More information about the Digitalmars-d-learn mailing list