Hacker News new | ask | show | jobs
by pjmlp 2077 days ago
There are always pauses at runtime, when a reference reaching the count of zero starts a domino effect of references being decreased to zero.

Which is why in most high performance RC, you get a tracing GC in disguise, because the actual deletion is moved into a background cleaning thread.

An example of this in production is the C++/WinRT framework for COM/UWP.

2 comments

In that regard it's not too dissimilar to Rust's semantics when memory is free'ed (https://news.ycombinator.com/item?id=23362518).

Nim's ARC does inject refs/decrs, but they're not atomic which means it's overhead can be pretty minimal. I don't know if ObjC/Swifts ARC uses atomics or locking. GTK's object system for example uses locking which makes it pretty expensive.

Ah, that's true.