Open generic function
Finalizes an object.
finalize object => ()
<object>.
None.
common-extensions
finalization
Finalizes object.
You can define methods on finalize to perform class-specific finalization procedures. These methods are called finalizers.
A default finalize method on <object> is provided.
The main interface to finalization is the function drain-finalization-queue, which calls finalize on each object awaiting finalization. Objects join the finalization queue if they become unreachable after being registered for finalization with finalize-when-unreachable. However, you can call finalize directly if you wish.
Once finalized, object is available for reclamation by the garbage collector, unless finalization made it reachable again. (This is called resurrection; see Section 2.5.2.7 on page 17.) Because the object has been taken off the garbage collector's finalization register, it will not be added to the finalization queue again, unless it is resurrected. However, it might still appear in the queue if it was registered more than once.
Do not write singleton methods on finalize. A singleton method would itself reference the object, and hence prevent it from becoming unreachable.
finalize-when-unreachable, page 57
drain-finalization-queue, page 57