[concurrency-interest] Memory sensitive memoization

Doug Lea dl at cs.oswego.edu
Mon Jun 27 08:04:44 EDT 2011


On 06/27/11 02:57, Sanchay Harneja wrote:
> On a side note, from my little testing I get the impression that weak refs are
> too aggressively garbage collected, whereas soft refs are only collected at the
> very last moment (effectively crawling the application when memory limit is
> hit).  Both don't work for our application. Think I would need a more
> comprehensive caching strategy.

Yes. A "Cache" is basically an enhanced concurrent map with
an expiration policy. There are enough possibilities for how
to expose and support expiration to have led us to stall for
years on releasing one. We will revisit this for jdk8.
In the mean time, guava MapMaker is a reasonable choice
for many usages.

-Doug


More information about the Concurrency-interest mailing list