08 July 2009

How Hotspot Decides to Clear SoftReferences

...IMHO using Softreferences in an application server is evil, because of this very coarse grained way to configure their behaviour. Note also that the mechanism implies that Softreferences will (in low memory situations) only be reclaimed after more than one full GC....This is precisely the problem that my colleagues encountered. They really want an LRU cache for what they are trying to do, and they tried to achieve it cheaply using SoftReferences.