同样的一个java进程,用top查询:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5466 root 15 0 2369m 106m 10m S 0.0 1.3 0:08.02 java
占用的内存RES是106m,
而用jmap -heap查到是这样:
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 2074083328 (1978.0MB)
NewSize = 1310720 (1.25MB)
MaxNewSize = 17592186044415 MB
OldSize = 5439488 (5.1875MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 21757952 (20.75MB)
MaxPermSize = 85983232 (82.0MB)
Heap Usage:
PS Young Generation
Eden Space:
capacity = 17760256 (16.9375MB)
used = 9450928 (9.013107299804688MB)
free = 8309328 (7.9243927001953125MB)
53.21391763722325% used
From Space:
capacity = 5046272 (4.8125MB)
used = 131072 (0.125MB)
free = 4915200 (4.6875MB)
2.5974025974025974% used
To Space:
capacity = 5373952 (5.125MB)
used = 0 (0.0MB)
free = 5373952 (5.125MB)
0.0% used
PS Old Generation
capacity = 86441984 (82.4375MB)
used = 34584152 (32.982017517089844MB)
free = 51857832 (49.455482482910156MB)
40.00851253020755% used
PS Perm Generation
capacity = 21757952 (20.75MB)
used = 9505648 (9.065292358398438MB)
free = 12252304 (11.684707641601562MB)
43.688155944088855% used
使用的加起来51m左右
请问应该怎样查一个java进程所占用的内存?
看了一些国外的文章,说java heap查的只有堆内存和 Perm 内存的大小,JVM 中还有栈内存,JNI等,每个线程还得占据一定的内存,有没有什么命令可以查询这些内存呢?