35.8. Garbage Collection and Multithreading

While the garbage-collection is executing, all other threads must stop. CLISP has a copying garbage-collector, so anything else would require a write barrier during the scan phase and a read barrier during the move phase.

Pinned heap objects. Heap objects may be pinned - they will not move during garbage-collection. Used when execution is blocked in a foreign/system call and a pointer into the heap is passed to non-lisp land. The garbage-collector tries to minimize the holes in the heap introduced by the pinning process. See also the note about system calls in Section 32.2.7.2, “clisp.h”.

Safe points. The threads may be stopped only at certain safe points. Currently implemented safe points are:

  1. Any heap allocation (actually before the allocation itself).
  2. Possibly blocking system call.
  3. Some places that may introduce infinite non-consing loops.

Basically any thread that conses or can block in a system call will not stop the garbage-collection from executing. There are still places where infinite non-consing loop without safe point may be reached (TODO: find and fix)


These notes document CLISP version 2.49.93+Last modified: 2018-02-19