RFR: 8257230: assert(InitialHeapSize >= MinHeapSize) failed: Ergonomics decided on incompatible initial and minimum heap sizes

Stefan Johansson sjohanss at openjdk.java.net
Mon Nov 30 17:26:59 UTC 2020


On Mon, 30 Nov 2020 14:38:55 GMT, Jie Fu <jiefu at openjdk.org> wrote:

>> src/hotspot/share/runtime/arguments.cpp line 1909:
>> 
>>> 1907:       reasonable_initial = limit_by_allocatable_memory(reasonable_initial);
>>> 1908: 
>>> 1909:       FLAG_SET_ERGO(InitialHeapSize, MAX2((size_t)reasonable_initial, MinHeapSize));
>> 
>> I'm not sure this is a good fix, this would violate the limit set by:
>> `limit_by_allocatable_memory(reasonable_initial);`
>> 
>> Wouldn't the proper fix be to make sure that MinHeapSize is also limited by what's allowed to allocate?
>
> The change just follows what is done for MaxHeapSize.
> 
> MaxHeapSize is limited by reasonable_max = limit_by_allocatable_memory(reasonable_max) [1].
> But it will be set to MAX2(reasonable_max, (julong)MinHeapSize) [2] if MinHeapSize is set. 
> 
> What do you think?
> 
> [1] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/runtime/arguments.cpp#L1876
> [2] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/runtime/arguments.cpp#L1885

I agree that the fix is in line with the current code and I guess setting `MinHeapSize` should override `MaxVirtMemFraction` and allow us to use more than half the address space specified.

In this case I think I would prefer moving the the call `limit_by_allocatable_memory(reasonable_initial);` [1] to right after the calculation on line 1902 [2]. This way we would only have one line doing lower limiting and one line doing upper limiting. 

Makes sense? Or will that lead to some other problem?

[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/runtime/arguments.cpp#L1907
[2] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/runtime/arguments.cpp#L1902

-------------

PR: https://git.openjdk.java.net/jdk/pull/1492



More information about the hotspot-gc-dev mailing list