Sobes.tech
Junior — Middle

What default memory cleaning algorithm is used in Java version 11?

sobes.tech AI

Answer from AI

In Java 11, the default garbage collector is G1 (Garbage-First Garbage Collector).

G1 is a parallel, incremental, and multithreaded garbage collector optimized for large heaps and minimizing pause times. It divides the heap into regions and collects them based on priority, allowing for more predictable pause time management.

To enable G1 by default, use the JVM flag -XX:+UseG1GC.