6.7 Finalization

6.7.1 Finalization and Disksave

Recall that the effect of the:full-gc keyword argument to disksave, when t, is to make all objects permanent. This would mean that an object registered for finalization would never be finalized, because finalization occurs during garbage collection, and permanent objects are never garbage collected.

Thus, it does not make sense to specify:

(disksave ... :full-gc t)
when finalizations are present in your image. When this situation occurs, the system enters an error break, offering a continuation in which it will delete all finalization registrations. (Recall that registration is only the request for objects to be placed on the queue.) We do this for performance reasons, but there is no attendant loss of generality. Alternatively, you can use the functiondelete-finalization-registration (see below).

Note that constructs such as weak sets are also affected by this kind of disksave. For instance, weak sets will no longer be "self-cleaning," since all their entries will be made permanent. No harm is done, as the newly permanent members of the weak sets might be deleted later.

When we do(disksave... :full-gc t), we copy all objects in dynamic space to static or read-write space; i.e., the objects become permanent. It is now pointless for them to be in weak sets or finalization registrations, since they will never be garbage collected.

The Advanced User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker