JDK-8013791 : G1: G1CollectorPolicy::initialize_flags() may set min_alignment > max_alignment
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2013-05-02
  • Updated: 2013-09-18
  • Resolved: 2013-05-06
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.
JDK 7 JDK 8 Other
7u40Resolved 8Fixed hs24Fixed
Description
We set min_alignment to the G1 heap region size, but we set max_alignment to the card table alignment.

The max_alignment is used to align the heap up. If the heap region size is larger than the card table alignment we may end up with a heap size that is not aligned to the heap region.

Here is a command line that fails on my machine:

$ java -XX:MaxRAMFraction=10 -XX:+UseG1GC -XX:G1HeapRegionSize=8m -version
Error occurred during initialization of VM
Size of g1 heap (859832320 bytes) must be aligned to 8388608 bytes

The test in Universe::check_alignment() fails even though the heap size was picked ergonomically. This is because the heap size is card table aligned rather than heap region aligned.

ILW=HML -> P2

The simplest workaround is to set the heap size on the command line to a value that is heap region size aligned.
Comments
Verified: alex@alex-ThinkPad-T420:~/jdk1.8.0/bin:1$./java -version java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b85) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b26, mixed mode) alex@alex-ThinkPad-T420:~/jdk1.8.0/bin:0$./java -XX:MaxRAMFraction=10 -XX:+UseG1GC -XX:G1HeapRegionSize=8m -version Error occurred during initialization of VM Size of g1 heap (826277888 bytes) must be aligned to 8388608 bytes alex@alex-ThinkPad-T420:~/fresh_jdk8/jdk-8-b90-hs25-b32/jdk1.8.0/fastdebug/bin:0$./java -XX:MaxRAMFraction=10 -XX:+UseG1GC -XX:G1HeapRegionSize=8m -version java version "1.8.0-ea-fastdebug" Java(TM) SE Runtime Environment (build 1.8.0-ea-fastdebug-b90) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b32-fastdebug, mixed mode)
09-07-2013