Re: Out-of-Memory Handling in Long-Running / Server Applications

Bob Lee <[email protected]> Sun, 13 Apr 2008 15:31:38 -0700
Newsgroups gmane.comp.windows.devel.java.advanced
Message-ID <[email protected]>
You might consider running the operations in their own VMs. You can reuse
them, let them die, and start new ones as necessary.

Bob

On Sun, Apr 13, 2008 at 8:41 AM, Randall R Schulz <[email protected]> wrote:

> Hi,
>
> My application has highly variable running times and memory demands
> based on the problems submitted to it. Some hard-to-solve (or
> insoluble) problems will run it out of memory.
>
> 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.
>
> This technique sometimes works and sometimes does not. I.e., when it
> doesn't work the program gets another OOM very shortly after or during
> the my OOM handling and dies.
>
> Until recently, this application was mostly run from the command line so
> this behavior was not such a big problem. Now it's being used much more
> in its Web-App form (running in Tomcat 5.5, at the moment), this
> inadequate handling is becoming a problem.
>
>
> What techniques are available for handling OOM errors in situations
> where simply dying on the spot is not an option?
>
>
> Thanks.
>
> Randall Schulz
>
> ===================================
> This list is hosted by DevelopMentor(R)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>

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

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