All topics / How Garbage Collectors Actually Work

How Garbage Collectors Actually Work

The engineering deep dive behind automatic memory management: reference counting vs. mark-and-sweep, why generational and concurrent collectors exist, and how to read a real GC log and tune the knobs that matter.

Download EPUB
  1. Reference Counting and Mark-Sweep, the Two Basic Ideas The two founding strategies for automatic memory management: counting who points at an object and freeing it at zero, versus tracing reachability from roots and sweeping what's left. Why reference counting alone can't handle cycles.
  2. Generational and Concurrent Collectors Why splitting the heap into young and old generations is the single biggest win in GC design, and how tri-color marking lets a modern collector trace reachability while your program keeps running instead of freezing it.
  3. Reading and Tuning a Real GC What a real GC log actually shows, the handful of tuning knobs that matter versus the ones that rarely do, and the honest first move before tuning: allocate less. Plus Rust's alternative - no collector at all.