News for hackers. Stuff that matters.
Re:Show HN: A pure reference counting GC in Go by zozbot234 on Wednesday January 15, 2020 @05:08AM (#22053060)
> If you add multi-threading and multi-core, there is lock contention for every single memory access to update the related counter.

You only have to update the counter when creating (or destroying) new "owning" references that might outlive any other reference to the object. This is a rare operation, and doing it potentially from multiple threads in a way that requires atomic update is even rarer.

> Additionally, if there is a big data structure in use, reaching zero will trigger a cascade deletion events reaching stop-the-world like effect.

This is a side effect of deterministic disposal, of course. And it only happens when freeing up large object subgraphs, not just any and all "large data structures".

Yes, C++ implements reference counting in a non-ideal way. Swift is also quite bad. But one can do better.

Re:Show HN: A pure reference counting GC in Go by pjmlp on Wednesday January 15, 2020 @05:35AM (#22053155)
When one does better it usually ends up with some form of tracing GC implementation, as per most CS research papers, it just gets to call it reference counting with optimizations to feel better.
Re:Show HN: A pure reference counting GC in Go by zozbot234 on Wednesday January 15, 2020 @06:02AM (#22053254)
That's definitely true of some enhanced variations on reference counting. The changes I mentioned though do not involve any tracing of live data at runtime. (Although once one introduces the possibility of general cycles, it seems hard to avoid the requirement of tracing some live data.)