Comment by louthy

7 months 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.

  • I was replying to the OP:

    > "but I was recently wondering if it would be possible to detect and deny pointer cycles in a language in an efficient way"

    ...not whatever issue you are worried about.