Garbage Collection for Rust: The Finalizer Frontier
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 allows existing Rust destructors to be automatically used as GC finalizers: this makes Alloy integrate better with existing Rust code than previous solutions but introduces surprising soundness and performance problems. Alloy provides novel solutions for the core problems: finalizer safety analysis rejects unsound destructors from automatically being reused as finalizers; finalizer elision optimises away unnecessary finalizers; and premature finalizer prevention ensures that finalizers are only run when it is provably safe to do so.
Authors
- Laurence Tratt (ORCID: https://orcid.org/0000-0002-5258-3805)
- Jacob Hughes (ORCID: https://orcid.org/0009-0002-5321-0645)
Institutions
- King's College London (GB)
Publication Details
- Journal
- Proceedings of the ACM on Programming Languages
- Published
- 2025-10-09
- DOI
- https://doi.org/10.1145/3763179
- Primary Topic
- Privacy-Preserving Technologies in Data
- Type
- article
- Field-Weighted Citation Impact
- 0.00