Themuppeteer
Programmer
Hello friends,
I know that the garbage collector of java removes objects without references.
Even if you have 2 objects A and B, and if A has a reference
to B, and you remove all links to A, it will remove A and B (since A is an object with no references to it).
But what if A has a reference to B, and B has a reference to A , and no other references to those objects are made anymore, will the garbagecollector detect that ?
And what if you push it a little further, and take 4 or 5 or even 'N' objects all connected to each other in a circle but with nothing else connected to them (so they live on an island),will the garbage collector detect that ?
A : removes A
A-->B : removes A and B
A<-->B : ?
A-->B-->C : ?
^_______|
I think (hope) it will, but I'm not sure and I have to be sure about this one.
Advice/opinions are welcome.
Best regards,
themuppeteer
Greetz,
NOSPAM_themuppeteer@hotmail.com (for mails, remove the NOSPAM_)
"Those who say they understand chess, understand nothing"
-- Robert HUBNER
I know that the garbage collector of java removes objects without references.
Even if you have 2 objects A and B, and if A has a reference
to B, and you remove all links to A, it will remove A and B (since A is an object with no references to it).
But what if A has a reference to B, and B has a reference to A , and no other references to those objects are made anymore, will the garbagecollector detect that ?
And what if you push it a little further, and take 4 or 5 or even 'N' objects all connected to each other in a circle but with nothing else connected to them (so they live on an island),will the garbage collector detect that ?
A : removes A
A-->B : removes A and B
A<-->B : ?
A-->B-->C : ?
^_______|
I think (hope) it will, but I'm not sure and I have to be sure about this one.
Advice/opinions are welcome.
Best regards,
themuppeteer
Greetz,
![img](http://www16.brinkster.com/themuppeteer/muppeteer.gif /img)
NOSPAM_themuppeteer@hotmail.com (for mails, remove the NOSPAM_)
"Those who say they understand chess, understand nothing"
-- Robert HUBNER