The JVM does not rely on a single garbage collection algorithm. Instead, it uses different garbage collection strategies depending on the selected Garbage Collector. These algorithms work together to identify unreachable objects and reclaim memory efficiently.
Most newly created objects are allocated in the Young Generation. If they survive multiple garbage collection cycles, they are promoted to the Old Generation, where they are managed differently to improve efficiency.
A concise interview answer is
JVM uses multiple garbage collection algorithms, including Mark-Sweep, Mark-Compact, Copying, and Generational Collection. Modern collectors such as G1 GC combine these techniques to efficiently reclaim memory while minimizing application pause times.
Last updated: 11 November 2026
Previous question: What is the role of the finalize() method in garbage collection?
Next question: How can memory leaks occur in Java even with automatic garbage collection?