"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
Originally posted by Paul Yule:
Isn't z available for GC? When the z Integer references y, y doesn't gain a reference to z does it? So z should be eligible for garbage collection. Perhaps there was suppose to be a line for "y=z"?
Hi Paul,
I'm thinking the same thing. Shouldn't z = null; be available for GC? It should, isn't it? What scope is there left for z?
When z Integer references y, y doesn't gain a reference to z? What do you mean?
Isn't z available for GC? When the z Integer references y, y doesn't gain a reference to z does it? So z should be eligible for garbage collection. Perhaps there was suppose to be a line for "y=z"?
Originally posted by Henry Wong:
Keep in mind -- References are *not* eligible for GC. It is the objects that are eligible for GC. So, when z is set equal to y, the object that is previously reachable via y, is now also reachable via z.
Originally posted by Henry Wong:
When z is set to null, the object is no long reachable via z, but to be eligible for GC, it must be not reachible. So, is the object that is no longer reachable via z, still reachable?
Originally posted by Paul Yule:
I was of the understanding that the pointer itself would also need to be GC'd. It's just under most circumstances this happened at the same time.