opensubscriber
   Find in this group all groups
 
Unknown more information…

a : advanced-java@discuss.develop.com 14 April 2008 • 5:54AM -0400

Re: [ADVANCED-JAVA] Out-of-Memory Handling in Long-Running / Server Applications
by Stephen Denne

REPLY TO AUTHOR
 
REPLY TO GROUP




Randall R Schulz wrote
> When memory is exhausted in the inner loop of the program (the only
> place it's going to happen), I catch the OutOfMemoryError, release the
> storage, trigger a GC (forcing it would seem desirable, but I'm not
> sure how to do that) and report the failure back up the call chain.
> The vast majority of the RAM is used in the search tree, which is
> linked only upwardly from the leaves and the leaves are all in a
> priority queue, so relinquishing the priority queue is enough to make
> all the objects in the tree unreferenceable.

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.

The tricky parts are efficiently ensuring it is only softly referenced, and dealing correctly with the queue disappearing.

Regards,
Stephen Denne.

Disclaimer:
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.
__________________________________________________________________

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.