Loading the code workspace…
Add a mark-and-sweep garbage collector to your VM in C.
Requirements:
Test:
Mark-and-sweep from the operand stack and call-frame locals as roots is exactly how Lua's real collector (lgc.c) and CPython's supplementary cycle-detecting GC work, layered on top of CPython's primary refcounting. This is the same algorithm family behind the 'stop-the-world pause' complaints developers make about the JVM's older GCs before G1 and ZGC.