RFR: 8284900: Check InitialHeapSize and container memory limits before startup [v8]
Severin Gehwolf
sgehwolf at openjdk.java.net
Thu Apr 21 10:00:29 UTC 2022
On Wed, 20 Apr 2022 16:10:12 GMT, xpbob <duke at openjdk.java.net> wrote:
>> Check InitialHeapSize and container memory limits before startup
>>
>>
>> Operating System Metrics:
>> Provider: cgroupv1
>> Effective CPU Count: 8
>> CPU Period: 100000us
>> CPU Quota: -1
>> CPU Shares: -1
>> List of Processors, 8 total:
>> 0 1 2 3 4 5 6 7
>> List of Effective Processors: N/A
>> List of Memory Nodes, 1 total:
>> 0
>> List of Available Memory Nodes: N/A
>> Memory Limit: 50.00M
>> Memory Soft Limit: Unlimited
>> Memory & Swap Limit: 60.00M
>> Maximum Processes Limit: 4194305
>>
>> command:-Xms60m -XshowSettings:system -version
>>
>>
>>
>>
>> When the memory limit is exceeded, the startup fail with message
>>
>>
>>
>> Error occurred during initialization of VM
>> Initial heap size set to a larger value than the container memory & swap limit
>
> xpbob has updated the pull request incrementally with one additional commit since the last revision:
>
> add test
src/hotspot/share/gc/shared/gcArguments.cpp line 147:
> 145: if (OSContainer::is_containerized() && FLAG_IS_CMDLINE(InitialHeapSize)) {
> 146: jlong limit = OSContainer::memory_and_swap_limit_in_bytes();
> 147: if ((limit > 0) && (InitialHeapSize >= (julong) limit)) {
Perhaps we should generalize this to use `os::physical_memory()` here instead of the Linux-specific `OSContainer` API? `os::physical_memory()` would return the container limit if it detects so.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8256
More information about the hotspot-gc-dev
mailing list