• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

Preventing an object from being garbage collected (was SCJP)

 
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 ]
 
Ranch Hand
Posts: 1249
Spring Java 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.
 
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.
 
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic