• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Preventing an object from being garbage collected (was SCJP)

 
Sophie Angela
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can we make a object never be garbage collected?can we put static modifier before a object..so thet it is never garbage collected?
[ August 30, 2006: Message edited by: Barry Gaunt ]
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jaiganesh Elumalai:
how can we make a object never be garbage collected?can we put static modifier before a object..so thet it is never garbage collected?


You may find this link usefull....

The Truth About Garbage Collection

there is a term called Resurrection. Please read it carefully.
Hope this may be usefull for you.
 
Praveen Babu
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jaiganesh Elumalai:
how can we make a object never be garbage collected?can we put static modifier before a object..so thet it is never garbage collected?


Yes, you can, static members are considered live members.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic