Hello, I have gone through this topic many times in K&B's book, but each time i end-up with confusion. Pls can anyone out there throw some light on this topic. This is from the test in the book which i wasn't able to understand. 1> objects with atleast one refrence will never be garbage collected. - i thought this stmt should be true - but it is not - explaination island of isolation. 2> If ob1 refers to ob2, then ob2 can't be garbage collected - this stmt is not true - again the same reason. Please these island of isolation --- will now isolate me if i don't get to understand them.
Mona(Varijasmom)
Aleksandar Stojanovic
Greenhorn
Joined: Sep 08, 2003
Posts: 26
posted
0
Hello Mona I will try to throw some light on your questions. Imagine situation that you have obj1 and obj2 and that obj1 refers to obj2, the same situation as in your question 2 OK, but now pay attention, imagine that obj1 is no longer in use and is not referenced by any object at all, what will happen with obj2 ? ( it will become eligible for garbige collection as obj1 too. ) The same situation for question 1. I hope that i've helped you to better understand garbige collection topic.