RFR (S): 8019902: G1: Use the average heap size rather than the minimum heap size to calculate the region size

Bengt Rutisson bengt.rutisson at oracle.com
Thu Aug 29 09:26:52 UTC 2013

Hi everyone,

Could I have a couple of reviews of this change:


The fact that G1 by default bases its region size on the minimum heap 
size means that out of the box the region size will always be 1M. This 
is a problem on large machines with lots of memory. We pick a large heap 
size but get a very small region size. The small regions are inefficient 
and cause a lot of memory footprint. Normally we aim to get around 2048 
regions, but on a machine with a lot of memory we might pick a default 
max heap size of 32G, which means that we will get ~32000 regions. This 
can lead to out of memory situations - especially on Solaris x86.

This patch changes the heuristics for picking the region size to use the 
average between initial heap size (-Xms) and the maximum heap size 
(-Xmx). This means that for large heaps we will pick larger region 
sizes. In the 32G example we will now pick a region size of 8m which 
means that we will have 4000 regions which is more reasonable.


More information about the hotspot-gc-dev mailing list