The JavaTM Tutorial

| Start of Tutorial > Start of Trail > Start of Lesson | Search Feedback Form

Trail: JDK(TM) 1.1 -- And Beyond!
Lesson: A Preview of Things to Come

## Weak References

> Weak references allow a program to maintain a reference to an object that does not prevent the object from being considered for reclamation by the garbage collector. They also allow a program to be notified when the collector has determined that an object has become eligible for reclamation. Weak references are useful for building simple caches as well as caches that are flushed only when memory is low, for implementing mappings that do not prevent their keys (or values) from being reclaimed, and for scheduling post-mortem cleanup actions in a more flexible way than is possible with the Java finalization mechanism.

| Start of Tutorial > Start of Trail > Start of Lesson | Search Feedback Form

Copyright 1995-2001 Sun Microsystems, Inc. All rights reserved.