RFR(s): 8067768: Check for too small values for -Xmx

Per Liden per.liden at oracle.com
Fri Mar 11 15:22:23 UTC 2016

On 2016-03-11 16:11, Jesper Wilhelmsson wrote:
> Looks good.

Thanks Jesper.

> Slightly related but probably a separate issue is that G1 needs
> InitialHeapSize >= 2M since it needs one young and one survivor region
> and the minimum region size is 1M...

In this case the VM will silently bump the InitialHeapSize to 2M (as 
long as it's not initialized to something below 1M). One can debate 
whether that is correct or not.

$ java -XX:+UseG1GC -Xms1M -Xmx2M -Xlog:gc+heap=debug -version
[0.010s][info][gc,heap] Heap region size: 1M
[0.010s][debug][gc,heap] Minimum heap 2097152  Initial heap 2097152 
Maximum heap 2097152


> /Jesper
> Den 11/3/16 kl. 15:52, skrev Per Liden:
>> Hi,
>> Summary: The VM needs at least a 2M heap (MaxHeapSize) and at least 1M
>> initial
>> heap (InitialHeapSize), but we only check the InitialHeapSize limit
>> during start
>> up. This patch adds a check for MaxHeapSize and extends the jtreg heap
>> size test
>> to check these limits.
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8067768
>> Webrev: http://cr.openjdk.java.net/~pliden/8067768/webrev.0/
>> Testing: manual, jtreg test/gc/*, jprt in progress
>> thanks,
>> Per

More information about the hotspot-gc-dev mailing list