Phantom memory

What is phantom memory and how it is useful?

Questions by almas

Showing Answers 1 - 3 of 3 Answers

A phantom reference lets you do final touch up closing on an object, even after it has been declared dead — no longer referenced by any live object.

Java has four orders of strength in holding onto Objects. In descending order from strongest to weakest they are:

1. The JVM holds onto regular Objects until they are no longer reachable by either  clients or any container. In other words Objects are garbage collected when there are no more live references to them. Dead references don’t count.

2. Soft references can be deleted from a container if the clients are no longer referencing them and memory is tight.

3. Weak references are automatically deleted from a container as soon clients stop referencing them.

4. Phantom references point to objects that are already dead and have been finalised.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions