Comment by munificent

17 hours ago

Reference counting can also have very bursty performance. Consider what happens when you decrement the last reference to an object which is the sole remaining reference to an entire large tree of other objects. This will trigger a whole cascade of subsequent decrements and deallocations, which can be arbitrarily large.

Of course, you might say, "Well, sure, but your reference counting implementation doesn't need to eagerly deallocate on dereference." That's true! You can write a ref counter that defers some of those deallocations or amortizes them across multiple operations.

And when you do that, now you really do have a garbage collector.

See: https://web.eecs.umich.edu/~weimerw/2008-415/reading/bacon-g...