Get the latest tech news
Techniques for safe garbage collection in Rust
Safe Garbage Collection in Rust 2024-01-13 - Rust and Garbage Collection - Tracing and Interior Mutability - Finding GC Roots with Generativity - Lifetime Projection - Putting It All Together - Closing Thoughts This will be the first in a series of posts describing different design decisions made writing two Rust crates: - gc-arena - A system for safely fitting Rust with incremental garbage collection, used by Ruffle. - piccolo - A stackless Lua runtime written in safe Rust with a focus on safe sandboxing.
The goal of this series of posts is not really to sell anyone on these crates, or even the ideas that went into them, but to document why I[1] in the case of gc-arena, we made the design decisions I did, and to touch on a web of issues and potential solutions that might[2] might be applicable to the larger Rust ecosystem. The terms around this are a bit contentious,[4] It is not inaccurate to refer to Rc and Arc as a form of garbage collection without cycle detection, and some people prefer to view them as part of the same continuum. The fact that Rust did not ship with this feature is maybe unsurprising in retrospect, since it is at odds in several ways with its design ethos,[5] ownership semantics, mutability XOR aliasing, and minimal behind-the-scenes runtime but this wasn't always the plan!
Or read this on Hacker News