Brussels / 4 & 5 February 2023


Whippet: A new production embeddable garbage collector

Replacing Guile's engine while the car is running

Guile has a new garbage collector coming! The Whippet collector improve throughput and scalability of Guile programs, and is built in such a way that it can be swapped into most any language runtime that uses that BDW-GC. With minimal adaptations in user code, you get a collector that's competitive with the industry-standard Boehm-Demers-Weiser conservative collector, but which scales better for multiple allocation threads. As incremental changes are made in Guile to integrate Whippet, we will also gain the ability to compact the heap, even while keeping conservative scanning of the C stack. This talk presents the structure of whippet and some performance numbers for how it improves Guile program behavior.

The Whippet garbage collector provides an abstract interface that user programs (like Guile) can use to allocate memory, and also provides a number of collectors that implement that API. One of them is the BDW-GC collector: this will be the first step in Guile's switch to Whippet, to change to use the Whippet API but keep the same GC implementation. Compile-time flags choose the collector implementation, and in the next step, Guile will switch over to Whippet's main collector, an Immix-derived mark-region collector. This collector has a few modes, including a heap-conservative mode that mimics BDW-GC, as well as a stack-conservative mode that allows evacuation and compaction of objects that aren't referenced by conservative roots.

The talk will include a quick overview of Immix-style collectors, for context.

Whippet scales: it has been carefully designed to avoid contention during allocation, and avoid locking except during collection. Collection is optionally parallel and optionally generational. We'll examine the performance and practical impacts of these choices, in synthetic test harnesses and in real Guile programs.

Whippet is designed to be included into a user's C source code, as it needs compile-time configuration. The talk will show examples of the size of the collector and its memory efficiency when compared to BDW-GC and to a semispace collector.


Andy Wingo