← Back to context

Comment by cogman10

6 hours ago

There are 2 unavoidable atomic updates for RC, the allocation and the free event. That alone will significantly increase the amount of traffic per thread back to main memory.

A lifetime system could possibly eliminate those, but it'd be hard to add to the JVM at this point. The JVM sort of has it in terms of escape analysis, but that's notoriously easy to defeat with pretty typical java code.

Why would an allocation require an atomic write for a reference count?

Swift routinely optimizes out reference count traffic.