aspose file tools
The moose likes Beginning Java and the fly likes Is phantomly reference  is  possible ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Is phantomly reference  is  possible ??" Watch "Is phantomly reference  is  possible ??" New topic

Is phantomly reference is possible ??

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234


I have read that

An object is phantomly reachable, it means the object already has been finalized but not yet reclaimed.

Could anybody please tell me , how this is possible ??

Save India From Corruption - Anna Hazare.
Stephan van Hulst

Joined: Sep 20, 2010
Posts: 3679

Because the designers made it to work. Is there anything specific you don't understand?
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

It is mainly a part of how the Garbage Collection and Java automatic memory management is working. If you don't have ANY references to an object it will be impossible to clean it out of the memory. It is also possible to reuse an object that might have been left for the GC to clean. One of those functions is when a piece of code is generating the same exception over and over again. The JVM might then choose to reuse the same Exception object and reclaim it from the GC.

To fully understand this, you should read up on Java memory management.
Consider Paul's rocket mass heater.
subject: Is phantomly reference is possible ??