Understanding the Go Runtime: The Memory Allocator
Summary
A detailed technical explainer of how the Go memory allocator operates within the Go runtime, covering the hierarchy of arenas, pages, and spans, size classes, the tiny allocator for small objects, and the three-level lock scheme (mcache, mcentral, mheap). It also explains GC integration via span bitmaps, lazy sweeping, and memory scavenging.