Garbage Collection (GC) in Java is an automatic process that removes unused objects in the Heap memory space, eliminating the need for manual memory management.
In Java, objects are considered garbage when no part of the program can reach them, and GC works in three main phases: Mark Phase, Sweep Phase, and Compact Phase.
Memory in Java is divided into Generations like Young Gen and Old Gen, where objects initially go to Young Gen and then to Old Gen after surviving several GC cycles.
Various GC strategies like Serial, Parallel, CMS, G1, and ZGC offer different benefits such as low pause times, better throughput and low latency balance, and ultra-low latency, catering to different use cases and applications.