Holding onto an Object Until Memory Becomes Low

A 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. }

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.