munificent/mark-sweep logo

munificent/mark-sweep

Free

A simple mark-sweep garbage collector in C

FreeFree tier
Type
Open Source

About munificent/mark-sweep

An educational implementation of a simple mark-sweep garbage collector in C. This repository contains sample code that accompanies a blog post on implementing a garbage collector, providing a hands-on example for learning the fundamental mark-sweep algorithm. The code is minimal and intended for learning purposes.

Key Features

Educational sample code for a mark-sweep garbage collector
Implements the mark-sweep algorithm
Written in C with a Makefile for building
Accompanies a detailed blog post explaining the implementation
Minimal and easy to understand

Pros & Cons

Pros
  • Simple and easy to understand, ideal for learners
  • Accompanies a well-explained blog post for deeper context
  • Illustrates core mark-sweep concepts without unnecessary complexity
Cons
  • Not suitable for production use
  • Does not include advanced features like generational or concurrent collection
  • May contain simplifications and potential bugs inherent in educational code

Best For

Learning garbage collection algorithmsTeaching compiler design and runtime systemsReference implementation for understanding mark-sweep GC in C

FAQ

What is this repository?
It is sample code for a blog post on implementing a simple mark-sweep garbage collector in C.
What language is it written in?
The code is written in C, with a Makefile for building.
Is this garbage collector production-ready?
No, it is an educational implementation intended for learning purposes and is not suitable for production use.