| The best part of these conversations is that if I say “garbage collection”, you have zero doubt that I am in fact referring to what you call “tracing garbage collection”. You are defining reference counting as being a kind of garbage collection, but you can’t point to why you are doing it. I can point to why that definition is misleading. Reference counting as most of the industry understands it is based on destructors. The semantics are: - References hold a +1 on the object they point to. - Objects that reach 0 are destructed. - Destruction deletes the references, which then causes them to deref the pointed at object. This is a deterministic semantics and folks who use RC rely on it. This is nothing like garbage collection, which just gives you an allocation function and promises you that you don’t have to worry about freeing. |
They are different approaches for the same thing: automatic memory management. (Which is itself a not trivial to define concept)
One tracks liveness, while the other tracks "deadness", but as you can surely imagine on a graph of black and white nodes, collecting the whites and removing all the others vs one by one removing the black ones are quite similar approaches, aren't they?