A deep dive into Go's memory allocator internals. Covers how the runtime avoids frequent OS syscalls by requesting 64MB arenas upfront, subdividing them into 8KB pages and then into spans holding fixed-size slots. Explains the 68 size classes (8B–32KB), the scan/noscan distinction yielding 136 span classes, and the tiny
Table of contents
When Does Memory Allocation Happen?Why Not Just Ask the OS?Arenas and PagesSpans: Where Objects LiveThe Locking ProblemThe Allocation FlowGarbage Collection IntegrationMemory Freeing and ScavengingSummarySort: