RFR: 8284900: Check InitialHeapSize and container memory limits before startup [v8]
Stefan Karlsson
stefank at openjdk.java.net
Thu Apr 21 11:49:42 UTC 2022
On Thu, 21 Apr 2022 09:57:10 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
>> 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.
@jerboaa Good point. Also take a look at Arguments::set_heap_size() and how that function uses os::physical_memory() and also limit_heap_by_allocatable_memory(). It seems like any change in GCArguments should go hand-in-hand with the code in set_heap_size.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8256
More information about the hotspot-gc-dev
mailing list