8195158: Concurrent System.gc() is "upgraded" to stop-the-world System.gc()

Erik Helin erik.helin at oracle.com
Wed Jan 17 15:33:00 UTC 2018

Hi all,

this patch fixes the bug 'Concurrent System.gc() is "upgraded" to 
stop-the-world System.gc()' [0]. The bug occurs when all of the 
following conditions are true:
- the heap is full (more strictly, there are no regions available for
- the Java program executes System.gc()
- the flag -XX:+ExplicitGCInvokesConcurrent is set
If all of the above are true, then G1 will do an initial mark YC and 
(since 862c41 [1]) "upgrade" the gc to a full GC. This "upgrade" should 
not happen since the user has explicitly set the flag 
-XX:+ExplicitGCInvokesConcurrent. Since the heap is full, it is likely 
that the next allocation will trigger a full GC, but the concurrent 
marking could also finish quickly and free up memory in the cleanup phase.



- newly added regression test
- hs-tier1, hs-tier2, hs-tier3, hs-tier7 on
   - Linux x86-64
   - Mac x86-64
   - Windows x86-64
   - Solaris SPARC


[0]: https://bugs.openjdk.java.net/browse/JDK-8195158
[1]: http://hg.openjdk.java.net/jdk/hs/rev/862c41cf1c7f

More information about the hotspot-gc-dev mailing list