| Author |
Garbage Collection
|
Aleix Vellozo
Greenhorn
Joined: Aug 23, 2006
Posts: 2
|
|
Hi all, I am a bit confused with the answer for Question 3 on Dan Chilsholm website: http://danchisholm.net/july21/topic/section3/gc1.html Which old object is he referring to here, q1 was initially set to null before the loop, so at this point no objects are eligible for gc right? Any comments on why the answer is 9, I would appreciate. Is it because all the 9 objects created will be eligible for gc when main() exit? Cheers.....
|
 |
wise owen
Ranch Hand
Joined: Feb 02, 2006
Posts: 2023
|
posted

0
|
There are 10 Q objects created by for loop. "When the processing of line 2 begins", there are 9 objects eligible for GC and one is still hold by q1.
|
 |
Aleix Vellozo
Greenhorn
Joined: Aug 23, 2006
Posts: 2
|
|
Thanks Wise, I thought I had gc worked out but it seems not. Why is the last object refereced by q1 not eligible for gc? Cheers.
|
 |
 |
|
|
subject: Garbage Collection
|
|
|