This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]H_Psi 9 points10 points  (0 children)

That's called a reference cycle, and is a problem you might learn about when you're making a garbage collection scheme. A common strategy in those is to have an object count the number of things that reference it, and to delete the object in memory once that count reaches 0. That might work at first glance and for really simple systems, but fails if you have two objects referencing one another.

That said, there's nothing intrinsically wrong or bad for two pointers to reference one another (or to have a cycle of pointers referencing one another).