Garbage Collection in Java: Choosing the Correct Collector

Garbage collection (GC) is a type of automatic memory management and a key feature of the Java platform. It allows developers to focus on their application logic rather than low-level memory management issues.

The Java platform implements multiple garbage collection algorithms, making it suitable for handling all kinds of workloads. The default collector, G1, is often a great choice, but depending on your use case, another GC might provide even better performance. This video explores:

  • the basics of garbage collection
  • why there are multiple collectors
  • key characteristics of G1 and ZGC
  • the performance differences between collectors and JDK releases.

Recorded at Devoxx Belgium 2025.