我正在尝试在VMware下运行的sles10 x64上使用xms = xmx分配ram。
停止JVM时会引发以下错误:
Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 12).
The RAM of the VM is 8 GB and they are reserved.
VM看到8GB,可以在运行时通过XMX设置分配。
在另一个具有16 GB RAM的虚拟SLES10上通过VMWare保留我即使在设置大页面和shmax时也没有RAM分配的问题,只有通过回声才能正常工作。
echo 8000>的/ proc / SYS / VM / nr_hugepages
echo 8589934592>的/ proc / SYS /内核/ SHMMAX
在其他SLES10上使用echo命令在/ proc / meminfo中根本没有效果。
这是我的配置第一个是XMS无法分配的SLES10。
# more /apps/liferay-portal-5.2.5/tomcat-5.5.27/bin/setenv.sh JAVA_HOME=/apps/java5 JRE_HOME=/apps/java5 JAVA_OPTS="$JAVA_OPTS -Xms3G -Xmx3G -XX:NewRatio=3 -XX:MaxPermSize=256m -XX:SurvivorRatio=20 -Dsun.rmi.dgc.client.gcInterval=1800000 -Dsun.rmi.dgc.server.gcInterval=1800000 -XX:+UsePa rallelGC -XX:ParallelGCThreads=4 -XX:+UseLargePages -Xloggc:/apps/gc.log -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGC -XX:+PrintGCTimeStamps - XX:+PrintGCDetails -Dfile.encoding=UTF8 -Duser.timezone=GMT+2 -Djava.security.auth.login.config=$CATALINA_HOME/conf/jaas.config -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_C LEAR_REFERENCES=false" more /etc/sysctl.conf kernel.shmmax=7516192768 vm.nr_hugepages=3072 vm.hugetlb_shm_group=1000 more /etc/securtiy/limits.conf # # #* soft core 0 #* hard rss 10000 #@student hard nproc 20 #@faculty soft nproc 20 #@faculty hard nproc 50 #ftp hard nproc 0 #@student - maxlogins 4 * soft memlock unlimited * hard memlock unlimited tomcat soft memlock 6291456 tomcat hard memlock 6291456 # End of file # cat /proc/meminfo MemTotal: 7928752 kB MemFree: 737004 kB Buffers: 0 kB Cached: 417368 kB SwapCached: 0 kB Active: 487428 kB Inactive: 324072 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 7928752 kB LowFree: 737004 kB SwapTotal: 2097144 kB SwapFree: 2097020 kB Dirty: 0 kB Writeback: 0 kB AnonPages: 397208 kB Mapped: 72180 kB Slab: 62136 kB CommitLimit: 2915792 kB Committed_AS: 748576 kB PageTables: 3292 kB VmallocTotal: 34359738367 kB VmallocUsed: 7028 kB VmallocChunk: 34359731271 kB HugePages_Total: 3072 HugePages_Free: 2305 HugePages_Rsvd: 897 Hugepagesize: 2048 kB # ipcs -l Shared Memory Limits -------- max number of segments = 4096 max seg size (kbytes) = 7340032 max total shared memory (kbytes) = 4611686018427386880 min seg size (bytes) = 1 Semaphore Limits -------- max number of arrays = 1024 max semaphores per array = 250 max semaphores system wide = 256000 max ops per semop call = 32 semaphore max value = 32767 Messages: Limits -------- max queues system wide = 16 max size of message (bytes) = 65536 default max size of queue (bytes) = 65536 # ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited pending signals (-i) 65536 max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 65536 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
在第二个VM上,它看起来像这样
cat /proc/meminfo MemTotal: 16190448 kB MemFree: 176812 kB Buffers: 52752 kB Cached: 755256 kB SwapCached: 0 kB Active: 713808 kB Inactive: 425300 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 16190448 kB LowFree: 176812 kB SwapTotal: 35658896 kB SwapFree: 35658796 kB Dirty: 932 kB Writeback: 0 kB AnonPages: 333620 kB Mapped: 79120 kB Slab: 37492 kB CommitLimit: 36356744 kB Committed_AS: 646284 kB PageTables: 3584 kB VmallocTotal: 34359738367 kB VmallocUsed: 23500 kB VmallocChunk: 34359713907 kB HugePages_Total: 7224 HugePages_Free: 6654 HugePages_Rsvd: 582 Hugepagesize: 2048 kB JAVA_OPTS="$JAVA_OPTS -Xms2G -Xmx2G -XX:NewRatio=3 -XX:MaxPermSize=256m -XX:SurvivorRatio=20 -Dsun.rmi.dgc.client.gcInterval=1800000 -Dsun.rmi.dgc.server.gcI nterval=1800000 -XX:+UseParallelGC -XX:ParallelGCThreads=2 -XX:+UseLargePages -Xloggc:/apps/gc.log -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplication ConcurrentTime -XX:+PrintGC -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Dfile.encoding=UTF8 -Duser.timezone=GMT+2 -Djava.security.auth.login.config=$CATALINA _HOME/conf/jaas.config -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false" hepide01pep1:~ # ipcs -l ------ Shared Memory Limits -------- max number of segments = 4096 max seg size (kbytes) = 8388608 max total shared memory (kbytes) = 4611686018427386880 min seg size (bytes) = 1 ------ Semaphore Limits -------- max number of arrays = 1024 max semaphores per array = 250 max semaphores system wide = 256000 max ops per semop call = 32 semaphore max value = 32767 ------ Messages: Limits -------- max queues system wide = 16 max size of message (bytes) = 65536 default max size of queue (bytes) = 65536
答案 0 :(得分:2)
您是否尝试使用较小的堆...可能是2gig。你可以做一个简单的尝试 java -Xmx3G -version。让我们知道它是怎么回事以及吐出来的。
答案 1 :(得分:1)
我在CentOS 5.9上偶然发现了这个问题(错误12)以及使用16G堆。
在/etc/security/limits.conf中验证硬/软内存锁是无限制的并且仍然出错之后,我开始按照Anil的建议运行java -version,我的所有JAVA_OPTS都完好无损。
我发现删除“-XX:+ UseLargePages”选项可以消除该错误。
我希望这可以帮到你!