The drain-finalization-queue function finalizes each object in the finalization queue by calling the generic function finalize on it. You should define methods for finalize on those classes whose instances may require finalization. These methods are called finalizers.
The recommended interface to finalization is through finalize-when-unreachable and drain-finalization-queue, but calling finalize on an object directly is also permitted. If you are certain you are finished with an object, it may be desirable to do so. For example, you might want to finalize an object created in a local binding before it goes out of scope.
Note: Finalizable objects are only removed from the register if the garbage collector discovers that they are unreachable and moves them into the finalization queue. Calling finalize on an object directly does not affect its registration status.
The drain-finalization-queue function makes each call to finalize inside whatever dynamic handler environment is present when drain-finalization-queue is called. If the call to drain-finalization-queue is aborted via a non-local exit during a call to finalize, the finalization queue retains all the objects that had been added to it but which had not been passed to finalize.
There is a default method for finalize on <object>. The method does nothing. It is available so that it is safe for all finalizers to call next-method, a practice that we strongly encourage. See Section 2.5.3.