Hello! I was just wondering what a ghost reference was? Is it that you don't have to refer to a object? EDIT: Sorry, I wasn't clear, the langauge is Java, and I read it about linked lists. While reading a problem to write a LinkedQueue iterator to support the remove method. Then, you would have a ghost reference.
I'm not sure if this is the same, but I think you might mean a weak reference.
Weak references are used in languages that have garbage collection to have a reference to an object without blocking the garbage collection from deleting the object if no non-weak references exist.
Different languages have different semantics for this functionality. Java defines soft, weak and phantom references, each with slightly different mechanics.
This is useful in many situations. For example, on the Blackberry, you can define a Listener object that listens for system events (such as a call coming in). When you register your listener with the system, it keeps a weak reference to it. That way, when all other references to that object go away (such as when the application shuts down), the weak reference no longer points to the listener and the memory is for that listener is freed without the programmer having to remember to unregister it.
As I stated in the comment, I don't know of a ghost reference, but this article has a nice write-up on the various weak references (weak, soft, and phantom). It even mentions the ReferenceQueue
issue, though I must say that I hadn't heard that before.