Randall R Schulz wrote
> On Sunday 13 April 2008 14:54, Stephen Denne wrote:
> > Randall R Schulz wrote
> > > ...
> > If your priority queue was only accessible via a SoftReference, then
> > when a request from anywhere for more memory can not be fulfilled,
> > your queue would be released automatically, avoiding an OOME.
> It's not a cache, memoizing store or TLB. It's a central data
> in the algorithm.
Yes, I understood that.
> It would hardly do to have it vanish unpredictably.
They "are cleared at the discretion of the garbage collector in response to memory demand."
Memory demand is what is giving you (or some other thread) an OOME.
But yes, you're at the mercy of particular garbage collector implementations.
What I really meant was that there are possibly satisfactory solutions to your problem based on using different strengths of references to objects.
Perhaps periodically check a softly referenced buffer, whose only purpose is to tell you whether it still exists. If not you're under memory pressure, and can take action (checking how much free memory there is, either aborting your processing, or reallocating your softy-referenced buffer).
At the Datamail Group we value team commitment, respect, achievement, customer focus, and courage. This email with any attachments is confidential and may be subject to legal privilege. If it is not intended for you please advise by reply immediately, destroy it and do not copy, disclose or use it in any way.
This email has been scanned by the DMZGlobal Business Quality
Electronic Messaging Suite.
Please see http://www.dmzglobal.com/dmzmessaging.htm for details.