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

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
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!