Re: Out-of-Memory Handling in Long-Running / Server Applications
Randall R Schulz <[email protected]> Sun, 13 Apr 2008 14:24:00 -0700
| Newsgroups | gmane.comp.windows.devel.java.advanced |
|---|---|
| Message-ID | <[email protected]> |
On Sunday 13 April 2008 13:56, Peter Booth wrote: > Here's my two cents: > > Catching an OutOfMemory error is a waste of time, because by the tim > eyou get that error all bets ar eoff an dthere is no guarantee that > the VM is functional. I guess I have to agree with this. You can catch it and, on a fairly hit-or-miss basis, perform some recovery and continue on, but it's far from a reliable technique and as such, pretty much worthless. > Here's the pragmatic solution: > > 1.) .... > n.) ... > 9) Have a cup of tea. Can I have coffee, instead? This recipe is suitable only for situations in which the memory requirements are well defined and have some sort of natural maximum and you're just trying to optimize the heap limits. In my case, problems vary considerably in their memory needs and the key deployment environment is within a servlet container, which may be configured with varying heap limits. So for me the only acceptable solutions are those that protect from uncontrolled failure modes and the potential undermining of the servlet container's stability when memory is exhausted. The solution pointed to by Burt Beckwith and outlined at <http://www.javaspecialists.eu/archive/Issue092.html> seems like the best approach. Randall Schulz =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com