[CM] S7s GC

bil at ccrma.Stanford.EDU bil at ccrma.Stanford.EDU
Mon Nov 23 05:50:34 PST 2020

As Kjetil says, it's a "tracing" GC (not based on refcounts
which I found a nightmare for the FFI user); it has two
generations, one immortal (never GC'd, not in the heap),
and the mortals.  It is concurrent in a small sense --
when s7 knows some cell is no longer needed, it immediately
frees it, rather than waiting for the GC to be triggered.
You can play with gc triggers and so on -- see the various
gc related fields in *s7*.  The problem with this in
real-time is that you don't know when the GC will pause
the s7 interpreter and do its thing; the gc call usually
is measured in milliseconds (set the gc-stats *s7* field
to see it being called, and how long it took), but that's
a long time in real-time audio work.  You can turn off
the gc in time-critical sections (s7_gc_on from C,
or the gc function in scheme), but if the heap fills
up, s7 has to stop and get more space.  The alternative
is a segfault.  So don't leave it off for very long!
Also you can't just call the gc yourself at any time --
someday I'll try to fix this, but for now, try to call
it only when nothing else is being evaluated).

More information about the Cmdist mailing list