![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e106. Holding onto an Object Until Memory Becomes LowA soft reference holds onto its referent until memory becomes low.// Create up the soft reference. SoftReference sr = new SoftReference(object); // Use the soft reference. Object o = sr.get(); if (o != null) { process(o); } else { // The object is being collected or has been reclaimed. }
e108. Determining When an Object Will Be Reclaimed © 2002 Addison-Wesley. |