Why G1 is default garbage collector for Java 9?

Sujeet U :

Till Java 8, we have seen Parallel GC as default garbage collector but the recent release of Java (Java 9) came up with G1 GC as default garbage collector.

Why has Java moved to G1 GC ? Is there any performance improvement ?

Oleg :

From JEP 248 (JEP - JDK Enhancement Proposal)

Summary

Make G1 the default garbage collector on 32- and 64-bit server configurations.

Motivation

Limiting GC pause times is, in general, more important than maximizing throughput. Switching to a low-pause collector such as G1 should provide a better overall experience, for most users, than a throughput-oriented collector such as the Parallel GC, which is currently the default.

Many performance improvements were made to G1 in JDK 8 and its update releases, and further improvements are planned for JDK 9. The introduction of concurrent class unloading (JEP 156) in JDK 8u40 made G1 a fully-featured garbage collector, ready to be the default.

In summary, this is something they were working on for a long time and for Java 9 they finally decided that it's ready to be default.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=444151&siteId=1