You can configure JVM to invoke any script when OutOfMemoryError is thrown. Most of the time,OutOfMemoryError doesn't crash the application