Destructor called while object is still alive

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sun Oct 25 21:02:07 UTC 2020


On Sunday, 25 October 2020 at 15:50:36 UTC, Steven Schveighoffer 
wrote:
> But even if you have synchronous management of files, having a 
> destructor clean up a file that obviously isn't used any more 
> isn't a bad thing.

Do you mean by the GC?

Well, it can be a bad thing if the GC most of the time run 
destructors if you do transactions that complete in destructors 
or have buffers that are flushed and closed in destructors. For 
correctness it is actually better that the GC never run 
destructors. Or... that the language is adjusted so that you get 
precise guarantees.





More information about the Digitalmars-d mailing list