一句话:提出并发部分追踪 GC 库,用阶段共识与 hazard pointer 实现非托管语言安全、高效、易集成的并发回收。
非托管语言(C/C++、Rust)并发内存回收难以兼顾效率、安全与易集成:BDWGC 等追踪收集器有停顿与不安全保守扫描,CIRC 等引用计数安全但开销高且需手动处理环。本文重新审视部分追踪 PT:根用引用计数精确识别,从非零计数对象追踪以回收循环垃圾。为克服根变更昂贵,作者提出并发部分追踪 CPT,用阶段共识在不停顿 mutator 下协调并发阶段并消除遍历中多数引用计数更新;进而提出 CDPT,用受阶段屏障保护的 hazard pointer 替代原子根更新。并发数据结构微基准与 Moka 缓存库宏观基准显示,CDPT 优于 BDWGC/CIRC,并与 RCU 等手动方案相当。
Garbage collection (GC) remains a desirable yet elusive goal in unmanaged languages like C/C++ and Rust, where concurrent memory reclamation must be achieved without compiler or runtime support. Existing techniques face fundamental trade-offs among efficiency , safety , and ease of integration : tracing collectors like BDWGC incur costly stop-the-world pauses and unsafe conservative scanning, while reference counting schemes like CIRC are safe but introduce high overhead and require manual handling of cyclic data. We present a safe, efficient, and easy-to-integrate concurrent GC library, revisiting partial tracing (PT), a concept initially conceived by Bacon et al. 22 years ago. PT is a hybrid approach that maintains reference counts for roots, ensuring safety through precise root identification, and traces from objects with non-zero counts, offering ease of integration by handling cyclic garbage. Although PT has historically been considered inefficient due to the high cost of root mutation, we overcome this limitation in two design steps. First, Concurrent Partial Tracing (CPT) introduces phase consensus , enabling concurrent phase coordination without mutator suspension and eliminating most reference-count updates during traversal. Second, Concurrent Deferred Partial Tracing (CDPT) further reduces overhead by replacing atomic root updates with a lightweight, hazard pointer (HP)-based mechanism safeguarded by a phase barrier . We show that CDPT outperforms automatic collectors like BDWGC and CIRC while being comparable to manual schemes like RCU, through both micro-benchmarks on concurrent data structures and a macro-benchmark on Moka, a production cache library.
@article{KimPKK26,
title = {Revisiting Partial Tracing for Safe, Efficient, and Concurrent Garbage Collection in Unmanaged Languages},
author = {Jeonghyeon Kim and Jongse Park and Youngjin Kwon and Jeehoon Kang},
journal = {Proceedings of the ACM on Programming Languages},
volume = {10},
number = {PLDI},
year = {2026},
doi = {10.1145/3808310}
}