Skip to main content

Posts

Showing posts with the label Gabage Collection

G1 Garbage Collector Explained

G1 Garbage Collector Explained G1 Garbage Collector Explained In G1 GC, the heap is divided into equal-sized regions. Each region can belong to one of the following categories: Eden : Where new objects are allocated. Survivor : Where objects that survive an initial garbage collection are moved. Old : Where objects that have survived multiple garbage collections are promoted. Humongous : Where very large objects that do not fit into a standard region are allocated. Key Concepts 1. Region-Based Memory Management : Each region is typically between 1 MB and 32 MB. The number of regions and their size can be controlled via the -XX:G1HeapRegionSize parameter. 2. Young and Old Generation : Unlike traditional generational collectors that have contiguous spaces for young and old generations, G1 has regions that can dynamically change their role. Young Ge...