RFR: 8223837: Add -XX:MinHeapSize flag to set the minimum heap size

Stefan Karlsson stefan.karlsson at oracle.com
Fri Jun 7 11:47:37 UTC 2019


I'll change the name. Thanks for reviewing.

StefanK

On 2019-06-04 09:48, Per Liden wrote:
> On 5/27/19 9:53 AM, Stefan Karlsson wrote:
>> Hi all,
>>
>> Please review this patch to add -XX:MinHeapSize flag to set the 
>> minimum heap size.
>>
>> http://cr.openjdk.java.net/~stefank/8223837/webrev.01/
>
> Looks good.
>
> One minor nit, "MinimumHeapSizeConstraintFunc" should probably be 
> "MinHeapSizeConstraintFunc", to match names of the related functions.
>
> cheers,
> Per
>
>> https://bugs.openjdk.java.net/browse/JDK-8223837
>>
>> Currently the -Xms flag is documented to set the initial heap size, 
>> but it also sets the minimum heap size. The initial heap size can be 
>> overridden with the -XX:InitialHeapSize flag, but there is no such 
>> flag for the minimum heap size.
>>
>> To set the minimum heap size to a value different than the initial 
>> heap size the user must specify -Xms before -XX:InitialHeapSize.
>>
>> For example:
>> -Xms4g -XX:InitialHeapSize=8g sets the minimum size to commit for the 
>> heap to 4g and the initially committed heap size to 8g.
>>
>> On the other hand, the following command line:
>> -XX:InitialHeapSize=8g -Xms4g sets both the minimum and initial heap 
>> size to 4g.
>>
>> This RFE proposes that we introduce a -XX:MinHeapSize flag to make it 
>> easier to independently set the minimum heap size and initial heap size.
>>
>> The user will get the expected behavior from either of the following 
>> command lines:
>> -XX:MinHeapSize=4g -XX:InitialHeapSize=8g
>> -XX:InitialHeapSize=8g -XX:MinHeapSize=4g
>>
>> The -Xms flag will keep it's old behavior and set both minimum and 
>> initial heap size, but when setting the minimum heap size it will 
>> change the MinHeapSize flag and not a JVM internal global variable. 
>> -Xms will behave as if both -XX:MinHeapSize and -XX:InitialHeapSize 
>> were set on the command line.
>>
>> The VM will enforce the relationship:
>> MinHeapSize <= InitialHeapSize <= MaxHeapSize
>>
>> I've created a CSR for this (JDK-8223852), but have not moved it out 
>> of draft yet. I'm also thinking about making MinHeapSize manageable, 
>> to allow the users to change the value the JVM is running, using our 
>> management APIs. Either I fold that into the same CSR, or I simply 
>> create a new CSR to cover that change.
>>
>> Tested with updated version of TestMaxHeapSizeTools.java, to only 
>> cover cases where MinHeapSize is set. That tool is used by the tests 
>> in Test<GC>HeapSizeFlags.java. Other suggestions of testing for this 
>> would be appreciated.
>>
>> Thanks,
>> StefanK




More information about the hotspot-gc-dev mailing list