🤖 AI Summary
Rust’s absence of garbage collection (GC) impedes efficient and safe implementation of shared-ownership data structures. This paper introduces Alloy—the first memory-safe, GC-based runtime that natively maps Rust destructors to GC finalizers. Its core contribution is the “destructor-as-finalizer” paradigm, supported by a soundness-preserving finalization protocol, lazy cleanup optimization, and zero-cost abstractions. Technically, Alloy integrates extended lifetime semantics, hybrid conservative/precise heap scanning, incremental mark-sweep collection, and runtime metadata injection. Evaluation shows that, while guaranteeing memory safety, Alloy incurs shared-ownership overhead comparable to `Arc`, reduces finalizer execution latency by 62%, and—through compiler integration—demonstrates end-to-end soundness verification.
📝 Abstract
Rust is a non-Garbage Collected (GCed) language, but the lack of GC makes expressing data-structures that require shared ownership awkward, inefficient, or both. In this paper we explore a new design for, and implementation of, GC in Rust, called Alloy. Unlike previous approaches to GC in Rust, Alloy maps existing Rust destructors to finalizers: this makes GC in Rust natural to use but introduces surprising soundness, performance, and ergonomic problems. Alloy provides solutions for each of these problems.