finds.dev← search

// the find

munificent/mark-sweep

★ 753 · C · NOASSERTION · updated Jun 2020

A simple mark-sweep garbage collector in C

A minimal mark-sweep GC implementation in a single C file, written as companion code for Bob Nystrom's 2013 blog post. It's a teaching artifact, not a library — the entire point is to be small enough to read alongside the article in an afternoon.

Single-file implementation makes the algorithm impossible to lose in abstractions. Nystrom's writing on the subject is genuinely good, and the code matches it step for step. Good starting point if you're building a language and need to understand the basics before reaching for a real GC. 753 stars after a decade says people keep finding it useful.

Last touched in 2020 (and substantively much earlier) — this is static reference material, not a maintained project. No generational collection, no incremental/concurrent collection, no compaction; fine for learning, unusable in production. There's no test suite. If you're looking for an embeddable GC you can actually ship, look at BDW-GC or MPS instead.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →