Java Garbage Collection

Garbage Collection automatically reclaims heap memory occupied by objects that are no longer reachable by any live thread. 1. Why GC exists Manual memory management is hard and error-prone: The JVM uses GC to: Production impact: 2. Heap structure (Young, Old, Metaspace) Modern HotSpot heap (simplified view): +———————————————————+| Java Heap || || +——————-+ +—————————–+ || […]