ivan alberdi

Greenhorn
+ Follow
since Feb 28, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ivan alberdi

ujjawal rohra wrote:When a1=null; b1=null; b2=null will execute only object referred to by a1
will be eligilble for GC.

b2 will not be eligible because b2 of a2 is pointing towards it(Line 14).

b1 will not be eligible because the static varable b1 of class Alpha objects is still
pointing to b1 (Line 12). Remeber static variable is shared by all the objects of
a class.
Therefore if you write a1.b1=b2 or a2.b1=b2 after line 12 then no object will
point towards b1 and then b1 will be eligible for GC but not now.

Hope this would help




Do you mean that b1 should be elegible for GC if you write a1.b1=b2 or a2.b1=b2 in line 12?.. but what about line 13 a1.b2=b1? We will find another reference in this line. Could you explain with more details your theory?

Thanks in advance.