What is a phantom reference?

John Zukowski

A phantom reference is a special type of reference object that allows you to perform cleanup after an object has been finalized but before the garbage collector has returned the space to the heap. It is implemented by the PhantomReference class in the java.lang.ref package.