#jmapjava
1. `jmap -heap pid`, JVM堆信息
using thread-local object allocation. Parallel GC with 4 thread(s) Heap Configuration: MinHeapFreeRatio = 0 MaxHeapFreeRatio = 100 MaxHeapSize = 2136997888 (2038.0MB) NewSize = 1310720 (1.25MB) MaxNewSize = 17592186044415 MB OldSize = 5439488 (5.1875MB) NewRatio = 2 SurvivorRatio = 8 PermSize = 21757952 (20.75MB) MaxPermSize = 85983232 (82.0MB) G1HeapRegionSize = 0 (0.0MB) Heap Usage: PS Young Generation Eden Space: capacity = 34078720 (32.5MB) used = 3408288 (3.250396728515625MB) free = 30670432 (29.249603271484375MB) 10.001220703125% used From Space: capacity = 5242880 (5.0MB) used = 0 (0.0MB) free = 5242880 (5.0MB) 0.0% used To Space: capacity = 5242880 (5.0MB) used = 0 (0.0MB) free = 5242880 (5.0MB) 0.0% used PS Old Generation capacity = 88604672 (84.5MB) used = 0 (0.0MB) free = 88604672 (84.5MB) 0.0% used PS Perm Generation capacity = 22020096 (21.0MB) used = 2690616 (2.5659713745117188MB) free = 19329480 (18.43402862548828MB) 12.218911307198661% used 1539 interned Strings occupying 141344 bytes.
2. `jmap -histo:live pid`能夠查看當前Java進程建立的活躍對象數目和佔用內存大小。
num #instances #bytes class name ---------------------------------------------- 1: 5956 767888 <methodKlass> 2: 5956 687232 <constMethodKlass> 3: 406 477264 <constantPoolKlass> 4: 2661 424416 [C 5: 369 285472 <constantPoolCacheKlass> 96: 2 64 [Ljava.lang.Thread; try 140: 1 32 java.security.Permissions 141: 1 24 java.util.concurrent.TimeUnit$4 142: 1 24 sun.launcher.LauncherHelper 143: 1 24 [Lsun.launcher.LauncherHelper; 191: 1 16 java.util.zip.ZipFile$2 192: 1 16 java.nio.Bits$1 193: 1 16 java.lang.System$2 194: 1 16 java.lang.Runtime 195: 1 16 java.util.Collections$EmptySet 196: 1 16 java.util.Collections$EmptyList 197: 1 16 sun.misc.Launcher$Factory Total 23841 3375688
3. `jmap -dump:format=b,file=e:\\dump.dat pid`導出dump文件,以供分析