Skip to content
tschatzl.github.io·

🌟OpenJDK 28: G1 GC Defaults and Major Improvements

G1 is now the default GC in OpenJDK 28

TL;DR

In the upcoming OpenJDK 28 release, G1 becomes the default garbage collector. This shift includes significant improvements like adaptive concurrent marking and bug fixes for weak references.

OpenJDK 28 is set to make G1 the default garbage collector if no other algorithm is specified on the command line. For developers running Java applications, this means a more robust and efficient memory management system out of the box. With around 350 changes in JDK 27's GC subcomponent alone, improvements include adaptive concurrent marking, fixing issues with weak references holding live objects, and better handling of large allocations. G1 no longer resizes the heap after Full GC based on MinHeapFreeRatio and MaxHeapFreeRatio percentages, setting them to 0 and 100 percent respectively.

Key Points

1

G1 becomes default GC in JDK 28 if no other algorithm is specified on command line

2

350 changes in JDK 27's GC subcomponent, including refactorings and bug fixes

3

Adaptive concurrent marking improved to be more resistant to adverse conditions

4

Fixed issues with weak references holding live objects (JDK-8378331, JDK-8378336)

5

Serial GC can still be selected with the -XX:+UseSerialGC option

Why It Matters

If you're running Java applications in production, G1 becoming the default GC means better memory management out of the box. Adaptive concurrent marking and fixes for weak references improve stability and performance. However, teams should evaluate their specific use cases to ensure G1 is the best fit.

openjdkgarbage-collectiong1-gcjvm

Frequently Asked Questions

Why does this matter?

If you're running Java applications in production, G1 becoming the default GC means better memory management out of the box. Adaptive concurrent marking and fixes for weak references improve stability and performance. However, teams should evaluate their specific use cases to ensure G1 is the best fit.

What happened?

In the upcoming OpenJDK 28 release, G1 becomes the default garbage collector. This shift includes significant improvements like adaptive concurrent marking and bug fixes for weak references.

Comments

Subscribe to join the conversation...

Be the first to comment

Enjoyed this article?

Get it daily. 7am. Free. Reads in 5 minutes.

Join 2,974 builders reading daily.

Also get