java堆分析工具jmap

11年前

jmap是比较地道本土的堆分析工具,应该掌握,下面讲讲如何运用。

// 打印jvm的堆状况,主要是年轻代和老年代信息  jmap -heap <pid>  如:  Heap Configuration:     MinHeapFreeRatio = 40     MaxHeapFreeRatio = 70     MaxHeapSize      = 536870912 (512.0MB)     NewSize          = 1310720 (1.25MB)     MaxNewSize       = 17592186044415 MB     OldSize          = 5439488 (5.1875MB)     NewRatio         = 2     SurvivorRatio    = 8     PermSize         = 21757952 (20.75MB)     MaxPermSize      = 268435456 (256.0MB)     G1HeapRegionSize = 0 (0.0MB)    Heap Usage:  PS Young Generation  Eden Space:     capacity = 46661632 (44.5MB)     used     = 1139464 (1.0866775512695312MB)     free     = 45522168 (43.41332244873047MB)     2.441972025324789% used  From Space:     capacity = 524288 (0.5MB)     used     = 0 (0.0MB)     free     = 524288 (0.5MB)     0.0% used  To Space:     capacity = 1048576 (1.0MB)     used     = 0 (0.0MB)     free     = 1048576 (1.0MB)     0.0% used  PS Old Generation     capacity = 112721920 (107.5MB)     used     = 54152304 (51.64366149902344MB)     free     = 58569616 (55.85633850097656MB)     48.04061534792878% used  PS Perm Generation     capacity = 94371840 (90.0MB)     used     = 94050296 (89.69335174560547MB)     free     = 321544 (0.30664825439453125MB)     99.65927971733942% used    37542 interned Strings occupying 3976528 bytes.