Re:Garbage Collection for Systems Programmers
by pkolaczk on Tuesday April 02, 2024 @07:11AM
(#39904409)
Refcounting introduces zero latency into code that doesn't allocate / free.
Tracing can pause such code. Zero latency is better than non-zero.
Re:Garbage Collection for Systems Programmers
by pron on Tuesday April 02, 2024 @01:50PM
(#39908691)
Modern concurrent collectors like ZGC only pause threads to synchronize state transitions -- there is no collection work done in STW pauses (or any work that grows with the size of the working set or total heap) -- and not for a longer duration than the OS does for various things. Certainly the average impact on latency is lower for concurrent tracing collectors.
These days, tracing collectors offer better throughput, latency and predictability than refcounting, while refcounting offers better footprint. That's the main tradeoff, and I mentioned some secondary ones (re ease of implementation and low-level "surprises") before.
If someday there's some advancement in refcounting that makes it better (or even as good but with significantly lower footprint), you'll see all languages that currenly use tracing switch quickly. For the time being, though, tracing is winning.