Java

Reference Objects

Documentation Contents
Reference objects support a limited degree of interaction with the garbage collector. A program may use a reference object to maintain a reference to some other object in such a way that the latter object may still be reclaimed by the collector. A program may also arrange to be notified some time after the collector has determined that the reachability of a given object has changed. Reference objects are therefore useful for building simple caches as well as caches that are flushed when memory runs low, for implementing mappings that do not prevent their keys (or values) from being reclaimed, and for scheduling pre-mortem cleanup actions in a more flexible way than is possible with the Java finalization mechanism.
API Specification
(javadoc)


Copyright © 1995-99 Sun Microsystems, Inc. All Rights Reserved.

Please send comments to: java-gc-comments@eng.sun.com. This is not a subscription list.
Sun
Java Software