1
JavaIntermediate#gc#memory
CMS (deprecated) minimizes pause times using concurrent marking but suffers fragmentation. G1 (default since Java 9) divides the heap into regions and balances throughput with predictable pause times. ZGC is a low-latency collector designed for huge heaps with sub-millisecond pause times.
// JVM flags to select a collector: java -XX:+UseG1GC MyApp java -XX:+UseZGC MyApp