-XX:+ExplicitGCInvokesConcurrent Disables Heap Shrinking at G1
Kim Barrett
kim.barrett at oracle.com
Sat Sep 19 09:25:53 UTC 2020
> On Sep 19, 2020, at 2:39 AM, Ruslan Synytsky <rs at jelastic.com> wrote:
>
> Hi, after analysis of one of the end user environments (JIRA), it looks
> like specifying +ExplicitGCInvokesConcurrent disables memory uncommitment
> even if you explicitly execute System.gc() or jcmd $pid GC.run.
>
> java -version
>
>
>
> *openjdk version "1.8.0_262"OpenJDK Runtime Environment
> (AdoptOpenJDK)(build 1.8.0_262-b10)OpenJDK 64-Bit Server VM
> (AdoptOpenJDK)(build 25.262-b10, mixed mode)*
>
> jcmd $pid VM.flags
>
> *-XX:CICompilerCount=3 -XX:ConcGCThreads=1 -XX:+ExplicitGCInvokesConcurrent
> -XX:G1HeapRegionSize=1048576 -XX:GCLogFileSize=20971520
> -XX:InitialCodeCacheSize=33554432 -XX:InitialHeapSize=402653184
> -XX:MarkStackSize=4194304 -XX:MaxHeapFreeRatio=30
> -XX:MaxHeapSize=3007315968 -XX:MaxNewSize=1803550720
> -XX:MinHeapDeltaBytes=1048576 -XX:MinHeapFreeRatio=10
> -XX:NumberOfGCLogFiles=5 -XX:-OmitStackTraceInFastThrow -XX:+PrintGC
> -XX:+PrintGCCause -XX:+PrintGCDateStamps -XX:+PrintGCDetails
> -XX:+PrintGCTimeStamps -XX:ReservedCodeCacheSize=536870912
> -XX:+UnlockExperimentalVMOptions -XX:+UseCompressedClassPointers
> -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:+UseG1GC
> -XX:+UseGCLogFileRotation *
>
> Min=384M
> Used=654M
> *Committed=1188M*
> Max=2868M
>
> The same application running without -XX:+ExplicitGCInvokesConcurrent
> option has twice smaller Committed heap.
>
> Min=384M
> Used=431M
> *Committed=598M*
> Max=2868M
>
> Is it an expected behavior?
Yes, this is expected.
Reducing committed memory after a concurrent collection was
RFE 6490394: G1: Allow heap shrinking / memory unmapping after reclaiming regions during Remark.
https://bugs.openjdk.java.net/browse/JDK-6490394
It was fixed in JDK 12, and has not been backported.
Before that change, G1 will only uncommit in a STW Full GC, and System.GC
doesn't do those when +ExplicitGCInvokesConcurrent.
> Thanks
> --
> Ruslan Synytsky
> CEO @ Jelastic Multi-Cloud PaaS
More information about the hotspot-gc-dev
mailing list