Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

When the a, and b are eligible for GC?  RSS feed

 
bujin wang
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Adrian Pang
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SCJP is properly a better forum for this post, but the variable is available for GC as soon as there are no more reference to it. The a inside testB is gone with the instance of testB is gone; which is the case when the instance of TestA is gone; which is the case when testAll completes. After testAll, a and b are candidates for GC.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!