What is Java’s default GC algorithm?

Ram - Jun 21 - - Dev Community

Image description

Are you wondering what the default Java Garbage Collection algorithm is? It depends on 3 factors:

  1. Who is your JVM Vendor (i.e., OpenJDK, OpenJ9, Azul …)?
  2. What version of Java are you running (i.e. Java 8, 11, 17…)?
  3. What class of JVM you are running (i.e. client or Server)?

Below table summarizes the default garbage collection algorithms for OpenJDK:

Image description

Besides the above-mentioned Serial GC, Parallel GC and G1 GC default algorithms, following algorithms are also available in OpenJDK: CMS GC, Shenandoah GC, ZGC, Epsilon GC. By following the tips given in this post, you can choose the right GC algorithm for your application

. . . . . . . . . . . . . . . . . .