← Back to context

Comment by jeremiep

8 years ago

Reference counting is a form of garbage collection. And depending on your usage patterns it might not even be the fastest one.

Lots of increments/decrements on the refcount interleaved in normal code can kill the gains over a traditional GC that has nearly free allocation, batched finalizations and doesn't pollute the instruction stream with increments/decrements.

Also with a traditional GC you pay nothing if you don't allocate memory; the collector will never run. You still pay the full price of reference counting no matter if you're done allocating or not.