Saturday 26 July 2014

Phantom Reference

Phantom Reference
An object that is not strongly, softly, or weakly reachable, has been finalized, and can be accessed through a phantom reference. All PhantomReference objects must be created with an associated ReferenceQueue. Since before the referent finalizable, it is added to reference queue.

Garbage Collector interaction with Phantom reachable object
1. The heap object that is referenced by the PhantomReference is declared finalizable.
2. Unlike soft and weak references, the PhantomReference is added to its ReferenceQueue before the heap object is freed. This allows for some needed actions to be taken before the heap object is reclaimed.


Related Links




Prevoius                                                 Next                                                 Home

No comments:

Post a Comment