31.8. Finalization
Prev | Chapter 31. Platform Independent Extensions | Next

## 31.8. Finalization

Calling `(`EXT:FINALIZE` `object` `function`)` has the effect that when the specified object is being garbage-collected, `(`FUNCALL` `function` `object`)` will be executed.

Calling `(`EXT:FINALIZE` `object` `function` `guardian`)` has a similar effect, but only as long as the `guardian` has not been garbage-collected: when `object` is being garbage-collected, `(`FUNCALL` `function` `object` `guardian`)` will be executed. If the `guardian` is garbage-collected before `object` is, nothing happens.

### Note

The time when “the `object` is being garbage-collected” is not defined deterministically. (Actually, it might possibly never occur.) It denotes a moment at which no references to `object` exist from other Lisp objects. When the `function` is called, `object` (and possibly `guardian`) enter the “arena of live Lisp objects” again.

No finalization request will be executed more than once.

| These notes document CLISP version 2.45 | Last modified: 2008-05-14

Enter your search termsSubmit search form
Webclisp.cons.orgclisp.podval.orgwww.lisp.org

Prev | Up | Next
31.7. Weak Objects | Home | 31.9. The Prompt