Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

when will garbage wiil be collected  RSS feed

 
srinivas yakala
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
when will garbage will be collected if our class contains static methods and non static methods.
when it will exactly happen

thanks in advance.

regards
srinivas.
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think there is any definitive answer to this because it depends on the garbage collector implementation. My knowledge is limited, but I believe in most modern implementations an object will be eligible for collection when it can no longer be reached from a 'root'. The non-static and static methods have nothing to do with each other in terms of collection. A static member has no effect on when a particular instance of that class may be collected.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!