std:std.resource.Resource.OnFinalize
The OnFinalize method.
This method will be invoked when a resource object's memory is about to be reclaimed and if the resource's Discard() method has never been called during the lifetime of the object.
This method is intended to be used for the 'last chance' cleanup of criticial OS resources, such as file handles, texture objects etc.
Code inside this method executes at a critical point in the garbage collection process, and should be kept short and sweet.
Code inside OnFinalize MUST obey the following rules:
are still valid when the finalizer executes.
Failure to follow these rules will lead to eventual disaster!