在 jre 1.6.43 中运行 java 进程时,我使用 top 命令监控内存使用情况,显示为:
top - 09:14:05 up 13 days, 23:04, 2 users, load average: 1.78, 1.35, 1.25
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.5%us, 1.3%sy, 0.0%ni, 95.7%id, 1.5%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 23651M total, 23466M used, 184M free, 402M buffers
Swap: 40962M total, 0M used, 40962M free, 17427M cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
23764 sysomc 20 0 695m 467m 12m S 16 2.0 58:53.41 java
然后,我在 jre 1.7.25 中运行 java 进程,top 命令显示内存使用情况,如:
top - 10:40:26 up 15 days, 31 min, 1 user, load average: 0.77, 0.89, 0.87
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.5%us, 1.3%sy, 0.0%ni, 95.5%id, 1.6%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 23651M total, 19892M used, 3758M free, 1651M buffers
Swap: 40962M total, 0M used, 40962M free, 12055M cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
27282 sysomc 20 0 1100m 896m 13m S 2 3.8 1:34.51 java
问题是,为什么 jre 1.6.43 和 jre 1.7.25 之间的 java 进程的常驻内存和虚拟内存使用情况非常不同