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