| Author |
Garbage Collection doubt
|
mamidi venkat
Ranch Hand
Joined: Jul 03, 2007
Posts: 62
|
|
Hi All X3 x2 = new X3(); X3 x3 = new X3(); X3 x5 = x3; x3 = x2; X3 x4 = x3; Question x5->x3 x3->x2 Can any one explains me what happens with x5 here is x5 is deleted because x3 having the reference of x2 or x5 is holding the reference of x3
|
 |
Kishore Kumar
Ranch Hand
Joined: Oct 15, 2007
Posts: 71
|
|
Here None of the object is garbage collected. x5 is pointing to the object which was created by x3 reference previously.
|
 |
mamidi venkat
Ranch Hand
Joined: Jul 03, 2007
Posts: 62
|
|
Thanks for reply i want to know one thing cleary objects are eligible for the garbage collection.what about object reference and static members x5->x3 x3->x2 x5=null now x5 is elibigle for the GC right
|
 |
Kishore Kumar
Ranch Hand
Joined: Oct 15, 2007
Posts: 71
|
|
|
Yes object refered by x5 is eligible for Garbage Collection.
|
 |
mamidi venkat
Ranch Hand
Joined: Jul 03, 2007
Posts: 62
|
|
Thanks for reply i want to know one thing cleary objects are eligible for the garbage collection. what about object reference and static members ???
|
 |
 |
|
|
subject: Garbage Collection doubt
|
|
|