在SUSE中,当用pmap 查看 java 进程时,会看到很多信息
> pmap 32088
32088: java
START SIZE RSS PSS DIRTY SWAP PERM MAPPING
0000000040000000 36K 36K 1K 0K 0K r-xp /usr/java/jdk1.6.0_31/bin/java
0000000040108000 8K 8K 8K 8K 0K rwxp /usr/java/jdk1.6.0_31/bin/java
000000004010a000 2492K 2448K 2448K 2448K 0K rwxp [heap]
0000000683600000 23104K 11276K 11276K 11276K 0K rwxp [anon]
0000000684c90000 1728K 0K 0K 0K 0K ---p [anon]
..............................................
00007fff26dd6000 4K 4K 0K 0K 0K r-xp [vdso]
ffffffffff600000 4K 0K 0K 0K 0K r-xp [vsyscall]
Total: 6594996K 82020K 73089K 72296K 0K
6382660K writable-private, 209860K readonly-private, 2476K shared, and 82016K referenced
“writeable/private” 是包括虚拟内存,公共lib等的进程消耗,对于Java进程 无参考意义,the RSS(物理内存)是要关注的。
注意:该值不只是heap
The memory usage for the java process is more that just the Java heap. It consists of (hope it didn't forget anything):
- the Java heap (where allocated objects go)
- the permgen (where static class data goes)
- the thread stacks (where method-local references, basic data values, and other information used to maintain method calling go)
- various other C/C++ data structures used by the JVM to do its job
- the binary code for the JVM and the libraries that it uses to do it job
- the binary, compiled code for the Java methods
这些命令也是非常有用的:
jstat -gc PIDtop -p PIDps -uf -p PID
jstack PID