Simple Garbage Collector for C in ~1300 lines of code

  • Well, this is a simple and slow Mark & Sweep.

    Much simplier and much faster is this simple copying collector from qish, which has ~740 lines of code. http://starynkevitch.net/basile/qishintro.html This one beats BoehmGC in every benchmark, which is the optimal implementation of the slow mark & sweep GC.

    The caveat for this fast copying collector is that you have to use volatile, as registers are not dumped to the stack, you cannot use stacked calls (same reason), and no threading.