在我们64位的CenterOS上,指定了JVM的最大堆内存为5500M,但是在top和进程status中可以看到实际占用内存已经远远大于5500M,那么JVM到底占用多大内存?如果做到控制JVM的占用内存大小?
root 21042 74.8 86.4 11194944 7072088 ? Sl Dec17 6818:07 /opt/j2sdk/bin/java -server
-Xms5500M -Xmx5500M -Xmn2000M -Xss128k -XX:PermSize=256m -XX:MaxPermSize=512m -XX:+UseParNewGC
-XX:ParallelGCThreads=8 -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=30
-XX:SoftRefLRUPolicyMSPerMB=0 -XX:+UseAdaptiveSizePolicy -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode
-XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=5 -XX:CMSInitiatingOccupancyFraction=55
-XX:CMSIncrementalSafetyFactor=20 -XX:+PrintGCDetails -XX:+PrintGCTimeStamps
-Djmagick.systemclassloader=false -DXCE_USE_DBCP -Djava.library.path=/opt/resin/libexec:/opt/j2sdk/lib:/usr/lib64
-DPASSPORT_CREATE_CLUSTER -Dresin.home=/opt/resin -Dserver.root=/opt/resin
-Djava.util.logging.manager=com.caucho.log.LogManagerImpl
-Djavax.management.builder.initial=com.caucho.jmx.MBeanServerBuilderImpl
com.caucho.server.resin.Resin -socketwait 52840 -stdout /opt/resin/log/stdout.log -stderr /opt/resin/log/stderr.log
top - 19:45:42 up 247 days, 7:42, 3 users, load average: 2.26, 2.30, 1.97
Tasks: 125 total, 1 running, 124 sleeping, 0 stopped, 0 zombie
Cpu(s): 8.7%us, 2.9%sy, 0.0%ni, 87.6%id, 0.0%wa, 0.0%hi, 0.7%si, 0.0%st
Mem: 8182228k total, 8125820k used, 56408k free, 110572k buffers
Swap: 4192956k total, 1844992k used, 2347964k free, 435444k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
21042 root 25 0 10.6g 6.7g 4680 S 95.2 86.4 6817:21 java
[root@xxxxxx ~]# cat /proc/21042/status
Name: java
State: S (sleeping)
SleepAVG: 0%
Tgid: 21042
Pid: 21042
PPid: 21040
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 8192
Groups: 0 1 2 3 4 6 10
VmPeak: 11260480 kB
VmSize: 11194944 kB
VmLck: 0 kB
VmHWM: 7257276 kB
VmRSS: 7073852 kB
VmData: 11095496 kB
VmStk: 84 kB
VmExe: 36 kB
VmLib: 68124 kB
VmPTE: 20860 kB
StaBrk: 5da65000 kB
Brk: 61fcf000 kB
StaStk: 7fffa59d3cd0 kB
Threads: 26825
SigQ: 0/69632
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000000001
SigCgt: 1000000181005cce
CapInh: 0000000000000000
CapPrm: 00000000fffffeff
CapEff: 00000000fffffeff
Cpus_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,000000ff
Mems_allowed: 00000000,00000001
©2009-2014 IMXYLZ
|求贤若渴