Garbage Collection Without Unsafe Code

https://fitzgen.com/2024/02/06/safe-gc.html

Article

TL;DR: Proof-of-concept GC implemented entirely in safe Rust — ergonomics suffer but it’s possible.

Key Takeaways

  • Requires wrapping all traced references in Gc<>, tying types permanently to a GC allocator
  • Proves the problem is solvable in safe Rust; future language features may fix ergonomic pain
  • At least 2-3 new Rust GC implementations have appeared since the Alloy paper survey

Discussion

  • [swiftcoder]: Neat proof-of-concept; ergonomics suffer but proves safety is achievable
  • [the-smug-one]: Gc<> wrapper forces types to couple to one specific allocator permanently
  • [ltratt]: Too many Rust GCs to track; an updated survey is overdue
  • Community agreed it’s a valid proof-of-concept but too ergonomically costly for production use today.

Discuss on HN


Type Link
Added Apr 22, 2026
Modified Apr 22, 2026