gc-before-c-hooks

Function

Package: excl

Arguments:

Returns a list whose entries each represent a C (or C-compatible) function to call before garbage collections of any kind. The typical declaration of the C function can be

int mybeforehook(int gctype);

where gctype is passed in as 0 if the current gc is a scavenge and 1 if a global-gc.

The list entry itself must be an (unsigned-byte 32) array of at least 1 entry, and its first entry must be the address of the C function.

setf can be used to store into the list.

A typical usage of this feature is

(let ((myaddr (ff:get-entry-point "mybeforehook"))) (push (make-array 1 :element-type '(unsigned-byte 32) :initial-element myaddr) (excl:gc-before-c-hooks)))

No gc hooks are saved across dumplisps. All applications are responsible for re-establishing their own gc-before-c-hooks.

See also gc.htm for general information on garbage collection Allegro CL.

Warning: No before hook should ever call back into lisp. The fact that during the hook call a gc is about to begin means that most likely there is no space in lisp heap. Also, it should never be assumed that the callback will not require lisp heap, even if the lisp function itself does not cons. A program whose before-hook calls into lisp may not fail the majority of the time, but it is likely to fail at some inopportune time with disastrous results.

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.