Using SoftReferences for caching
From: Jesper Nordenberg (megagurka_at_yahoo.com)
Date: 02/12/04
- Next message: Adam: "Re: Application wide properties file"
- Previous message: Bert Schader: "Re: Java and XML "templates""
- Next in thread: Conor White: "Re: Using SoftReferences for caching"
- Reply: Conor White: "Re: Using SoftReferences for caching"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 12 Feb 2004 00:50:36 -0800
I'm writing an application where I have a memory cache of objects
stored on disk. There are no limitations on the object sizes, one
object can be as large as the heap. A long value is used to identify
an object, so there can be a huge amount of objects.
I want to use a fixed amount of the heap or all the available heap for
the cache. I can't cache a fixed number of objects since I don't know
how how much memory an object occupies, and thus the program can run
out of memory. So, using SoftReferences seems like a good solution.
One problem is that the HashMap used in the cache can become very big
and needs to be cleared of SoftReferences that has been nullified.
If someone have some implementation or design suggestion that would be
great. Maybe there is some open source project that implement a
similar cache?
/Jesper Nordenberg
- Next message: Adam: "Re: Application wide properties file"
- Previous message: Bert Schader: "Re: Java and XML "templates""
- Next in thread: Conor White: "Re: Using SoftReferences for caching"
- Reply: Conor White: "Re: Using SoftReferences for caching"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|