Search code examples
javaout-of-memoryheap-dump

can java server survive after OutOfMemoryError


Can java server survive after below errors

java.lang.OutOfMemoryError:

Java heap space java.lang.OutOfMemoryError: GC overhead limit exceeded

In my application i got heap dump after this error still I see some logs getting printed after this error also. Not able to understand how it is survived after Error.


Solution

  • Yes -- it is possible to survive an OOM exception, but you likely lost a thread in the process. Once that thread died, all memory that it was holding on to got GC'd and you continued to run.

    I'd never advise relying on this behavior though because you can't guarantee which thread is going to die.