简体   繁体   中英

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.

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.

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

The first process starts as a Windows service. 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:

-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.

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. Why is the UseParNewGC warning being issued on that machine but not others?

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.

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?

When you use Windows 32-bit JVM the maximum heap size is limited to between 1.2G and 1.5G depending on the OS. It is possible the default is already too big.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM