FunctionPackage: exclToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Moderately revised from 10.0.
10.0 version


Arguments: object function &key queue

Returns a finalization for object. When the garbage collector identifies object as garbage (meaning only the finalization and possibly weak vectors reference it), the garbage collector notes this fact and when it finishes garbage collecting, it either (depending on the value of the queue argument) calls the function denoted by function with object as the single argument or enqueues a list of two elements (the function from the finalization and the object in question) on the queue denoted by queue.

If queue is nil and thus the function is called by the system when object is marked as garbage, then after that function returns, the finalization is disabled so that (assuming that nothing in function caused object not to be garbage) the object is again identified as garbage during the next garbage collection and then scavenged (or global gc'ed) away.

If queue is non-nil, it must be an instance of mp:queue. The system only places the list of the finalization function and the object on that queue. It is the programs responsibility to apply the function call-finalizer to that list.

object can be any Lisp object; function can be a function object or a symbol denoting a function. The function must accept one argument.

Multiple finalizations can be scheduled for the same object; all are run if and when the gc identifies the object as garbage. The order of the running of multiple finalizations is unspecified.

A finalization can be unscheduled with unschedule-finalization.

Note that a reference from a weak vector or hash-table is not a reference from the point of view of the garbage collector. Consequently, a weak vector or hash-table can contain a pointer to an object on which a finalization is being called, or has already been called. See the section A finalized object may still be pointed to by a weak vector or hash-table in gc.htm for more information.

See also gc.htm for general information on garbage collection Allegro CL. See section Finalizations in that document for details of finalizations.

Copyright (c) 1998-2017, Franz Inc. Oakland, CA., USA. All rights reserved.
This page has had moderate revisions compared to the 10.0 page.
Created 2017.2.15.

Allegro CL version 10.1
Moderately revised from 10.0.
10.0 version