Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: I've added Tom's comment into the Applicability section (reworded)

...

Allowing a system error to propagate out of a Java program may result in a denial-of-service attack.

In the event of actually running out of memory, it is likely that something will be in an inconsistent state and it might be best to restart the process.  If an attempt is made to carry on, reducing the number of threads, or just cycling them, may be a good idea since threads often leak memory.

The methods Thread.setUncaughtExceptionHandler() and ThreadGroup.uncaughtException() can be used to help deal with an OutOfMemoryError in threads.

Bibliography

[JLS 2011] §11.2, Compile-Time Checking of Exceptions
[Kalinovsky 2004] Chapter 16, Intercepting Control Flow: Intercepting System Errors

...