JDK-6822429 : configuration anomaly in JRE 6 wrt NewSize parameter: JVM refuses to start
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 5.0u24,6u13
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris
  • CPU: sparc
  • Submitted: 2009-03-26
  • Updated: 2011-03-15
  • Resolved: 2010-08-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0-poolResolved
Related Reports
Duplicate :  
Relates :  
Description
A configuration anomaly wrt the NewSize parameter was observed 
beginning with JRE 6 Update 4. As a result the JVM refuses to 
start and issues confusing error message:

Error occurred during initialization of VM
Could not reserve enough space for object heap


The issue is strictly reproducible.

1. Testcase
-----------
% more Test.java
public class Test {
   public static void main(String[] args) {
      System.out.println("Hello");
   }
}

Compile:
% /jdk1.6.0_03/bin/javac Test.java
%

2. Run on 6u4, 6u7, 6u12, 6u13
------------------------------
% /jdk1.6.0_04/bin/java -XX:NewSize=32m -Xms128m -Xmx128m Test
Error occurred during initialization of VM
Could not reserve enough space for object heap
%
% /jdk1.6.0_07/bin/java -XX:NewSize=32m -Xms128m -Xmx128m Test
Error occurred during initialization of VM
Could not reserve enough space for object heap
%
% /jdk1.6.0_12/bin/java -XX:NewSize=32m -Xms128m -Xmx128m Test
Error occurred during initialization of VM
Could not reserve enough space for object heap
%
% /jdk1.6.0_13/bin/java -XX:NewSize=32m -Xms128m -Xmx128m Test
Error occurred during initialization of VM
Could not reserve enough space for object heap
%

3. Compare: run on 6u3
----------------------
% /jdk1.6.0_03/bin/java -XX:NewSize=32m -Xms128m -Xmx128m Test
Hello
%

4. Increase NewSize value
-------------------------
% /jdk1.6.0_13/bin/java -XX:NewSize=39m -Xms128m -Xmx128m Test
Error occurred during initialization of VM
Could not reserve enough space for object heap
% /jdk1.6.0_13/bin/java -XX:NewSize=40m -Xms128m -Xmx128m Test
Hello
%

5. Add MaxNewSize parameter
---------------------------
% /jdk1.6.0_13/bin/java -XX:NewSize=32m  -XX:MaxNewSize=64m -Xms128m -Xmx128m Test
Error occurred during initialization of VM
Could not reserve enough space for object heap
% /jdk1.6.0_13/bin/java -XX:NewSize=32m -XX:MaxNewSize=32m -Xms128m -Xmx128m Test
Hello
%

Comments
EVALUATION Multiple bugs on the same issue, closing as up of 6979312.
31-08-2010

EVALUATION runs : test15/bin/java -showversion -Xmx1G -XX:NewSize=256M Test fails : test15/bin/java -showversion -Xmx1G -Xms1G -XX:NewSize=256M Test A VM that logs sizes while initialising show that sizing of the new generation is going wrong: it's too large. In the problem sparc/c2 case, NewRatio=2 gives us a new gen size of 1024/NewRatio+1, which is 341MB. That's greater than the NewSize=256MB from the command-line, and in the ParallelGC case we aren't recognising that. This problem starts happening in 6u4 as well as 5u24, but goes away in 6.0 in u14, where there is much change in this area, e.g. 6711316: Open source the Garbage-First garbage collector We aren't planning to make those changes in 5.0, so ParallelGC needs to recognise that we have Xmx==Xms and use the specified NewSize for MaxNewSize (perhaps in TwoGenerationCollectorPolicy::initialize_size_info() ).
27-08-2010

WORK AROUND Any of: -client -XX:+UseSerialGC -XX:+UseConcMarkSweepGC i.e. the automatically-chosen c2 and -XX:+UseParallelGC are the problem. But specifically on sparc c2. -XX:-UseAdaptiveSizePolicy does NOT workaround. So this is platform-specific, in the sizing of the new gen (too large in the crashing case), which leads to another workaround of: -XX:NewRatio=8 ..to duplicate good x86 behaviour, or good sparc -client behaviour, when using sparc -server. (also, NewRatio=2 duplicates the problem behaviour on x86).
27-08-2010

WORK AROUND Set -XX:NewSize==-XX:MaxNewSize. e.g: -XX:NewSize=32m -XX:MaxNewSize=32m
26-03-2009