1

In our java application, we need to send email in case the application goes out of memory and recovers from it by its own. To do so, we need a callback kind of thing that should be called once the JVM recovered from OOM. Is there such a callback in Java?

trincot
  • 317,000
  • 35
  • 244
  • 286
Kather
  • 95
  • 8

1 Answers1

1

Use -XX:OnOutOfMemoryError=<command> JVM option.

If you need more flexible error handling within the Java process itself, look at ResourceExhausted JVMTI callback.

apangin
  • 92,924
  • 10
  • 193
  • 247