About ParallelGC for different JDK versions
I am sure that Jdk11 also supports ParallelGC, and also supports Min/MaxHeapFreeRatio
parameters.
- The following code is taken from OpenJdk11 source
code. (source code link)
size_t PSAdaptiveSizePolicy::calculated_old_free_size_in_bytes() const {
size_t free_size = (size_t)(_promo_size + avg_promoted()->padded_average());
size_t live = ParallelScavengeHeap::heap()->old_gen()->used_in_bytes();
if (MinHeapFreeRatio != 0) {
size_t min_free = calculate_free_based_on_live(live, MinHeapFreeRatio);
free_size = MAX2(free_size, min_free);
}
if (MaxHeapFreeRatio != 100) {
size_t max_free = calculate_free_based_on_live(live, MaxHeapFreeRatio);
free_size = MIN2(max_free, free_size);
}
return free_size;
}
- I found the exact same method in the source code of OpenJdk8。(source code link)
Therefore, I can confirm that the Min/MaxHeapFreeRatio
parameters can be used normally by ParallelGC of different JDK versions.
About parameter settings do not take effect in JDK11
This parameter does fail under certain circumstances, but before explaining that, I would like to explain what Min/MaxHeapFreeRatio
really does. This parameter acts directly on Old Gen, and is used to control the proportion of the remaining space in the old generation in the entire old generation, rather than the proportion of the remaining space in the entire heap in the entire heap!
I tried to explain in detail with a diagram. The following diagram is a structure diagram of ParallelGC heap memory:

Use Size: Refers to the space occupied by surviving objects in the old gen after GC. Free Size: is the current remaining unused space in the old gen
Through the following formula, we can calculate the proportion of the remaining space in the old generation to the total old generation space.
HeapFreeRatio = (Free Size) / (Old Gen Size) * 100
ParallelGC makes HeapFreeRatio meet the Min/MaxHeapFreeRatio
requirement by dynamically adjusting the size of Old Gen after GC.
Old Gen Size = Free Size + Use Size
special case
When the Use Size is too large, Min/MaxHeapFreeRatio will indeed fail.
As the Use Size becomes larger, ParallelGC has to continue to meet the requirements of Min/MaxHeapFreeRatio by expanding the Old Gen. And because Current Heap Size = Young Gen + Old Gen
, so expanding the size of the Old Gen will make the Current Heap Size expand, but the Heap Size has a maximum upper limit. So the following picture will appear (Current == Max):

At this time, ParallelGC can no longer meet the requirements of Min/MaxHeapFreeRatio by expanding Old Gen, but if the Use Size continues to grow, the following situation will occur:

In the above case, the Use Size is too large and the Free Size becomes smaller, so that (Free Size / Old Gen) * 100 < MinHeapFreeRatio. At this point, there will be a phenomenon that does not match your expectations.
in conclusion
Min/MaxHeapFreeRatio is a soft limit, when Current Heap Size < Max Heap Size
, ParallelGC can guarantee HeapFreeRatio
fulfil requirements. But when Current Heap Size == Max Heap Size
, ParallelGC cannot guarantee that HeapFreeRatio meets the requirements. If you still have doubts about this, I hope to communicate with you further.