220.127.116.11 Hooks for Garbage Collection
Whenever Guile performs a garbage collection, it calls the following
hooks in the order shown.
C hook called at the very start of a garbage collection, after setting
scm_gc_running_p to 1, but before entering the GC critical
If garbage collection is blocked because
non-zero, GC exits early soon after calling this hook, and no further
hooks will be called.
C hook called before beginning the mark phase of garbage collection,
after the GC thread has entered a critical section.
C hook called before beginning the sweep phase of garbage collection.
This is the same as at the end of the mark phase, since nothing else
happens between marking and sweeping.
C hook called after the end of the sweep phase of garbage collection,
but while the GC thread is still inside its critical section.
C hook called at the very end of a garbage collection, after the GC
thread has left its critical section.
Scheme hook with arity 0. This hook is run asynchronously
(see Asyncs) soon after the GC has completed and any other events
that were deferred during garbage collection have been processed. (Also
accessible from C with the name |
All the C hooks listed here have type
initialized with hook closure data NULL, are are invoked by
scm_c_hook_run with call closure data NULL.
The Scheme hook
after-gc-hook is particularly useful in
conjunction with guardians (see Guardians). Typically, if you are
using a guardian, you want to call the guardian after garbage collection
to see if any of the objects added to the guardian have been collected.
By adding a thunk that performs this call to
can ensure that your guardian is tested after every garbage collection