How to know about OutOfMemory or StackOverflow errors ahead of time

前端 未结 11 1736
余生分开走
余生分开走 2021-02-15 17:10

In Java, is there a way to know that a StackOverflow error or OutOfMemory exception may happen soon?

The OutOfMemory exception m

11条回答
  •  囚心锁ツ
    2021-02-15 17:30

    The MemoryMXBean can emit notifications if your memory reaches a certain threshold.

提交回复
热议问题