Circular Object Reference
800457Oct 4 2007 — edited Oct 4 2007If I have two objects, each with a reference to the other, will the garbage collector ever remove them if nothing else is referencing either one? In other words, if the only thing referencing object A is object B and the only thing referencing object B is object A will the garbage collector realize that these two objects can be removed?
A google search seems to indicate that it will but given that a static variable referencing an object instance (such as the Singleton pattern) will prevent the object from being removed I'm not so sure this is true.
I would try to create a test case to see for myself if this works but don't know how to begin. I guess I don't fully understand the GC process.