sun.com/j2se/1.5.0/docs/guide/refobs/"> http://java.sun.com/j2se/1.5.0/docs/guide/refobs/ for more information. These classes include
weak references that allow the Garbage Collector (GC) to collect objects they reference, setting the reference to
null
in the process.
The reference problem requires us to be careful about how we define the reachability of directed acyclic graph (DAG) nodes. If we were to allow nodes to be reached by arbitrary graph traversal, we would be unable to garbage collect any subgraphs of an active graph at all since any node may be reached from any other. Instead, we define the set of reachable nodes as those that may be accessed directly from a reference in user code, or that are the source (not sink) of a reachable node. Reachable nodes are always accessible, whether they are reached by traversing upwards or downwards in the DAG.
A DAG may also contain nodes that are not reachable, that is, they require a downward traversal at some point. For example, assume a node A
is reachable, and a call to A.getSinks()
yields a Vector
containing a reference to a previously unreachable node B
. The node B
naturally becomes reachable by virtue of the new user reference pointing to it. However, if the user were to relinquish that reference, the node might be garbage collected, and a future call to A.getSinks()
might no longer include B
in its return value.
Because the set of sinks of a node is inherently unstable, only the getSinks
method is provided for external access to the sink vector at a node. A hypothetical method such as getSink
or getNumSinks
would produce confusing results should a sink be garbage collected between that call and a subsequent call to getSinks
.
@see java.awt.image.RenderedImage
@see java.lang.ref.Reference
@see java.lang.ref.WeakReference
@see ImageJAI
@see OpImage
@see RenderedImageAdapter
@see SnapshotImage
@see TiledImage