--- old/src/hotspot/share/runtime/arguments.cpp 2017-10-24 13:05:04.468615764 -0400 +++ new/src/hotspot/share/runtime/arguments.cpp 2017-10-24 13:05:03.476559203 -0400 @@ -382,6 +382,7 @@ { "MaxRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, { "MinRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, { "InitialRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, + { "UseCGroupMemoryLimitForHeap", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::jdk(11) }, // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in: { "DefaultMaxRAMFraction", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() }, @@ -2680,6 +2681,14 @@ return result; } + // We need to ensure processor and memory resources have been properly + // configured - which may rely on arguments we just processed - before + // doing the final argument processing. Any argument processing that + // needs to know about processor and memory resources must occur after + // this point. + + os::init_container_support(); + // Do final processing now that all arguments have been parsed result = finalize_vm_init_args(patch_mod_javabase); if (result != JNI_OK) { @@ -3355,12 +3364,6 @@ _exit_hook = CAST_TO_FN_PTR(exit_hook_t, option->extraInfo); } else if (match_option(option, "abort")) { _abort_hook = CAST_TO_FN_PTR(abort_hook_t, option->extraInfo); - // -XX:+AggressiveHeap - } else if (match_option(option, "-XX:+AggressiveHeap")) { - jint result = set_aggressive_heap_flags(); - if (result != JNI_OK) { - return result; - } // Need to keep consistency of MaxTenuringThreshold and AlwaysTenure/NeverTenure; // and the last option wins. } else if (match_option(option, "-XX:+NeverTenure")) { @@ -3642,6 +3645,16 @@ return JNI_ERR; } + // This must be done after all arguments have been processed + // and the container support has been initialized since AggressiveHeap + // relies on the amount of total memory available. + if (AggressiveHeap) { + jint result = set_aggressive_heap_flags(); + if (result != JNI_OK) { + return result; + } + } + // This must be done after all arguments have been processed. // java_compiler() true means set to "NONE" or empty. if (java_compiler() && !xdebug_mode()) {