Prajwal Tuladhar home

Garbage Collection in Java

07 Mar 2016

JVM provides number of Garbage Collector modes based on nature of the appications.

In all Java GC modes except G1, heap is divided into 3 parts: Young Generation, Old Generation and Permanent Generation. Young generation is furthur divided into 3 layers:

G1 GC uses less contiguous approach or more logical generations for laying out heap structure resulting the VM to provide dynamic sizing of youg and old generations. G1 GC still uses basic layout of conventional JVM GC like Young Generation being divided into Eden and Survivor regions. Most allocations happen in eden except for “humongous” allocations. G1 GC is designed to be One GC to rule them all from latency sensitive applications (HTTP servers) to throughput sensitive applications (Indexing, Batch Processing). From JDk9, G1 is going to be the default GC mode.