如何判断我是否接近使用jmap的OutOfMemoryError?

时间:2017-12-13 11:38:27

标签: java jvm heap-memory jmap

我试图了解我应该在jmap outpout中检查哪些值来检测JVM是否接近抛出OutOfMemoryError。

e.g。 jmap -heap pid 可以是值的组合(已接近或已达到100%)?

1 个答案:

答案 0 :(得分:0)

jmap -heap pid

有一个名为Heap Usage的字段:

Heap Usage:
PS Young Generation
Eden Space:
   capacity = 560988160 (535.0MB)
   used     = 193192264 (184.24250030517578MB)
   free     = 367795896 (350.7574996948242MB)
   34.43785052433192% used
From Space:
   capacity = 40370176 (38.5MB)
   used     = 40357616 (38.48802185058594MB)
   free     = 12560 (0.0119781494140625MB)
   99.96888792359984% used
To Space:
   capacity = 52953088 (50.5MB)
   used     = 0 (0.0MB)
   free     = 52953088 (50.5MB)
   0.0% used
PS Old Generation
   capacity = 783286272 (747.0MB)
   used     = 35294904 (33.65984344482422MB)
   free     = 747991368 (713.3401565551758MB)
   4.506003138530685% used

所以你可以看到使用百分比。