Comment by louthy
2 days ago
On any one object you can just follow the references to see if you get back to the same object. Not super efficient as you’d have to do it for each reference as it is set.
But if it was a simple scripting language and you needed that constraint, it’s relativity easy to implement.
That would still be tracing. The problem is that if there is a cycle, the reference count would be too high, and you'd not detect that the object should be reclaimed.