Jmap view memory usage and generate heapdump — conversion

PHP? uid=191&do=blog&id=7572"> http://www.webspherechina.net/home/space.PHP?uid=191&do=blog&id=7572

If you want to analyze your Java application, you can use the jmap program to generate the heapdump file. Example: jmap - heap 1234 (1234 is the process number) jmap is a tool provided with JDK. It is very compact and convenient. Its supporting parameters are as follows: - heap prints the summary of heap space, where you can roughly check the usage of heap space. Example: jmap - heap 12345 output: attaching to process ID 2657, please wait Debugger attached successfully. Client compiler detected. JVM version is 1.5. 0_ 16-b02 using thread-local object allocation. Mark Sweep Compact GC Heap Configuration: MinHeapFreeRatio = 40 MaxHeapFreeRatio = 70 MaxHeapSize = 67108864 (64.0MB) NewSize = 655360 (0.625MB) MaxNewSize = 4294901760 (4095.9375MB) OldSize = 1441792 (1.375MB) NewRatio = 12 SurvivorRatio = 8 PermSize = 8388608 (8.0MB) MaxPermSize = 67108864 (64.0MB) Heap Usage:New Generation (Eden + 1 Survivor Space): capacity = 4521984 (4.3125MB) used = 1510200 (1.4402389526367188MB) free = 3011784 (2.8722610473632812MB) 33.39684527853261% usedEden Space: capacity = 4063232 (3.875MB) used = 1495992 (1.4266891479492188MB) free = 2567240 (2.4483108520507812MB) 36.81778446320565% usedFrom Space: capacity = 458752 (0.4375MB) used = 14208 (0.0135498046875MB) free = 444544 (0.4239501953125MB) 3.0970982142857144% usedTo Space: capacity = 458752 (0.4375MB) used = 0 (0.0MB) free = 458752 (0.4375MB) 0.0% usedtenured generation: capacity = 59342848 (56.59375MB) used = 36321192 (34.638587951660156MB) free = 23021656 (21.955162048339844MB) 61.20567721994064% usedperm generation: capacity = 11796480 (11.25mb) used = 11712040 (11.169471740722656mb) free = 84440 (0.08052825925927734375mb) 99.28419325086806% the output above used is very simple. Start to output the environment used by our Java in this process from the fourth line. Heap configuration refers to some JVM parameters set during startup. Such as the maximum used memory size, the old generation, the young generation, the persistent generation size, etc. With this, you can easily view the memory usage of this process. Maybe the process takes up a lot of total memory, but we can see that not much is really used here. Many are "free". The accumulation of memory usage is mostly in the older generation, and memory pool exposure begins here, so we should pay special attention to "tenured generation"- Heap: format = B generates a heapdump file, which is an important parameter for generating heapdump files. Example: jmap - heap: format = B 2657 will generate a heap Heapdump file for bin. Note that the parameter for generating heapdump is jdk1 5. The format in 1.6 is: jmap - dump: live, format = B, file = XXX 2657. It is more powerful here. You can specify the surviving object and the file name that generates heapdump- Histo will generate a class statistics report here. This table is very simple, such as showing what class has, how many instances and how many bytes it occupies, as follows: size count class description -------------------------------------------------------------- 8394352 105 long [] 8293192 57202 char [] 7834776 14157 byte [] 6713592 53743 * constmethodklass4194320 1 com xjawa. cms5server. Kontent[]4055072 12319 int[]3291104 85082 * SymbolKlass3016040 53743 * MethodKlass2774936 4253 * ConstantPoolKlass1871480 4253 * InstanceKlassKlass1811808 3990 * ConstantPoolCacheKlass1488672 62028 java. lang.String1203280 13258 java. Lang. object [] - permstat prints the memory usage status of some persistent generations, including "live" and "dead". I don't use much.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>