I built a garbage collector for a language that doesn’t need one

Over the summer, the author spent their time building a garbage collector in Rust, a language designed to eliminate garbage collection. They explained that Rust’s standard library offers reference-counted garbage collectors, but they cannot handle cyclic references. So, the author aimed to create a garbage collector that can handle cyclic references and nearly any data type. They used the visitor pattern from Java and implemented a bulk-dropping technique to optimize the drop operation. The author also discussed making the garbage collector concurrent, but noted that there can be concurrency issues with cyclic references.


To top