...
Allowing a system error to propagate out of a Java program may result in a denial-of-service attack.
Bibliography
[JLS 2011] §11.2, Compile-Time Checking of Exceptions
[Kalinovsky 2004] Chapter 16, Intercepting Control Flow: Intercepting System Errors
...
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()andThreadGroup.uncaughtException()can be used to help deal with anOutOfMemoryErrorin threads.