I built a garbage collector for Rust (2023)

18 points by abhin4v


snej

I’m not doubting the benchmarks, but I have trouble seeing how this can be fast. Gc::drop runs a (fairly expensive looking) scan whenever the target object's refcount is > 1, which must be pretty common. That’s a significant write barrier. Or did I miss a later step where that gets optimized?

I’ve seen other ref-counting implementations with cycle collectors (e.g. Nim's) and usually they only run the collector periodically (IIRC), not on every release.