[英]Java could not reserve enough space for object heap - multiple java processes
One of our customers is running into this error message when trying to start a second java process. 我们的一位客户在尝试启动第二个Java进程时遇到了此错误消息。
Error occurred during initialization of VM
Could not reserve enough space for object heap
It's strange because out of the 8 Gigs of memory available, only 2 or 3 are being used. 这很奇怪,因为在可用的8 Gig内存中,仅使用了2或3。
The command to start the second process works fine if the the first process isn't running. 如果第一个进程未运行,则启动第二个进程的命令将正常运行。 Here the command used to start the second process: 这是用于启动第二个过程的命令:
java -jar Xmx512m -jar xxxJar.jar java -jar Xmx512m -jar xxxJar.jar
The first process starts as a Windows service. 第一个过程从Windows服务开始。 I don't know a good way to display the startup command for a service, it's very likely executing our startup batch file. 我不知道显示服务启动命令的好方法,很有可能执行我们的启动批处理文件。 By going through the batch file, it looks like the following Java options are being used: 通过查看批处理文件,看起来正在使用以下Java选项:
-Xms1g -Xmx1g -Xss256K -Xverify:none -XX:+TieredCompilation -XX:+UseBiasedLocking
-XX:+UseParNewGC -XX:InitialCodeCacheSize=8m -XX:ReservedCodeCacheSize=32m
-Dorg.terracotta.quartz.skipUpdateCheck=true
Also the service startup displays this warning: 服务启动也显示以下警告:
Java HotSpot(TM) 64-Bit Server VM warning: Using the ParNew young collector with the Serial old collector is deprecated and will likely be removed in a future release
Which is also strange because I don't see the warning other systems. 这也很奇怪,因为我没有看到其他系统的警告。
The platform is JDK 1.8.0_111, Windows Embedded 2010. 该平台是Windows Embedded 2010的JDK 1.8.0_111。
The questions are: 1. why is the Java unable to start when there are 5.5 gigs of available memory, and it's only asking for .5 Gigs max? 问题是:1.为什么在有5.5个可用内存的情况下Java无法启动,并且只要求.5 Gigs max?
Instead of 代替
java -jar Xmx512m -jar xxxJar.jar
try 尝试
java -Xmx512m -jar xxxJar.jar
The default is to reserve 1/4 of main memory and I suspect it is failing to do that before it gets a chance to report you have used -jar
twice. 默认值是保留主内存的1/4,我怀疑在有机会报告您已两次使用-jar
之前,它没有这样做。
Any idea why it can't get space just when the other service is running, yet there's still 5..5 Gigs of core available? 知道为什么仅在运行其他服务时就无法获得空间,但是仍然有5..5 Gig的可用核心吗?
When you use Windows 32-bit JVM the maximum heap size is limited to between 1.2G and 1.5G depending on the OS. 使用Windows 32位JVM时,根据操作系统的不同,最大堆大小限制为1.2G至1.5G。 It is possible the default is already too big. 默认值可能已经太大。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.