logo

Enhanced Garbage Collection


Show

JEP 304 - Garbage-Collector Interface

Prior to Java 10, GC (Garbage Collector) executing components were dispersed within the codebase and weren't convertible easily. With Java 10, the Garbage-Collector interface is launched in order that alternative GC implementations are often plugged in. It also helps out in segregating the codebase from many different garbage pickup executions. This feature is a component of JEP 304.

JEP 307 - Parallel Packed GC for G1

Java 9 launched G1 (Garbage First) garbage man. G1 neglects full garbage collection but only in case of concurrent threads forage for collection and memory isn't revived fast enough, so a user experience is impacted. With Java 10, now G1 will use a fallback Full garbage pickup.

With this alteration, G1 improves its worst-case latency by employing a Full GC in parallel. At the present, G1 uses one threaded mark-sweep-compact algorithm. With JEP 307, a parallel thread will start a mark-sweep-compact algorithm. The number of threads is often controlled using the following option.

$java -XX:ParallelGCThreads=4