• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

gc: object reference

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most books mention that ONLY objects with no references will be garbage collected.
However, Mughal & Rasmussen states that an object is only eligible for garbage collection if the only references to the object are from other objects that are also eligible for garbage collection. In other words, they still have references.
Does anybody know how to answer if such question appears in exam?

[This message has been edited by Kevin Yip (edited May 05, 2001).]
 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kevin,
I understand your difficulty. The best way to answer the
questions on Garbage collection is use a paper and pen.
Assign the reference to the object created, do so meticulously
after each execution and as soon as you see that a particular
object is not reacheable by any refernce, then the JVM will
find the object that has been derefenced eligible for garbage collection.
There are many discussion happening in this forum you may search and refer to them for more insights.
Ravindra Mohan
------------------
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!