EN
Back to the archive

The archive · Product Ideas · Technical decision · 2020

Micro-mitten tests compile-time garbage collection without Rust's ownership rules

A research language tries 'unrestrictive compile-time garbage collection': data-flow analysis inserts frees, with no ownership or lifetimes required.

Nathan Corbyn (project author)

The ideaAnalyze whole-program data flow to approximate when heap values die, and insert the frees at compile time — no tracing garbage collector, no ownership restrictions.incremental

What it had to solve

Rust showed that memory safety can be checked at compile time, but its ownership and lifetime system dictates how code may be structured, while tracing garbage collectors do their work at runtime. Micro-mitten, a bare-bones Rust-like research language, asked whether a compiler could instead infer heap liveness from data-flow analysis and insert the freeing code itself, leaving the programmer unrestricted.

How it works

Micro-mitten began as a question: can a programming language manage memory at compile time without forcing Rust-style ownership on the programmer? Rust had shown that static memory management need not mean manual frees, but its single-ownership and lifetime system constrains how code is written. Tracing garbage collectors remove that burden but pay for it at runtime. Micro-mitten asked whether whole-program data-flow analysis could approximate when heap objects die, so the compiler itself could insert the freeing code.

The project, tagged with the slogan 'metal's too hot? wear a mitten!', is a deliberately stripped-down Rust-like language. Its compiler lowers .mmtn sources to LLVM, and the distinguishing machinery is a series of data-flow analyses that approximate heap liveness and place frees at the right program points — what the author calls an attempt to see if 'unrestrictive compile-time garbage collection' is really possible. A --gc-strategy flag lets the same test programs compile either with the static strategy or with Boehm's libgc, turning the language into a benchmark for the idea.

The theory came from Proust's 2017 University of Cambridge thesis (UCAM-CL-TR-908), which the readme cites directly; the author's own dissertation is linked as the full write-up of the implementation. The Show HN post of 8 May 2020 drew 236 points and 62 comments, with the discussion comparing the approach to automatic reference counting, region-based memory and Rust's ownership model, and debating how far compile-time liveness analysis can scale.

Micro-mitten never claimed to be production software: the readme notes that performance under static memory management is not brilliant and that one or two examples still leak. Its value was demonstrative — proving that a compiler can insert frees from data-flow liveness without restricting how code is written — and the archived repository page shows 539 stars as evidence of the idea's reach among compiler and systems programmers.

Why it lands

  • It attacked a real dichotomy: the field offered either tracing GCs that run at runtime or ownership systems that constrain the programmer, and micro-mitten built and ran a third option.
  • Grounding the implementation in a published Cambridge thesis gave the side project a rigorous foundation and a citation a skeptical audience could open.
  • Shipping a working compiler with a comparison flag let people evaluate the claim empirically instead of arguing about whether static liveness analysis could ever free memory.
  • Framing it as research set honest expectations — known leaks and modest performance were stated upfront — which is why the HN thread stayed technical and constructive.

What it did

Launched on Hacker News on 8 May 2020 with 236 points and 62 comments, where the idea was debated against automatic reference counting, conventional GC and Rust's ownership; the archived repository page shows 539 stars. It remained a research artifact — static memory management performance was acknowledged as 'not brilliant' and a few examples leaked — but it demonstrated that unrestrictive compile-time garbage collection can be built and run.

Their sitemicro-mitten repository

What you can take

When dominant solutions force a trade — runtime overhead or ownership rules — build the smallest artifact that tests a third path; even a slow prototype can prove a mechanism possible.

Since then

Micro-mitten remained a research artifact rather than a product: the readme documents the examples that run under static management, notes the memory leaks that remain, and points to the author's dissertation for the full design. The Hacker News debate it generated — where compile-time liveness analysis sits against reference counting, regions and ownership — is the project's most durable output, alongside the archived page's 539 stars.

Sources

spotted an error? The archive wants to know.

Your turn

You just read one. Describe the brief you are staring at, and see who has been given the same problem.

Free account · 3 free questions · no card

Related cases