NOTE

Go Heap Management

Go runtime heap allocation, size classes, spans, per-P caches, sweeping, and GC interaction.

GoCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

Go’s runtime manages heap allocations with size classes, spans/pages, central structures, and per-P caches so many small allocations avoid a global lock. Exact allocator internals are runtime-version specific.

Allocation rate matters because it drives garbage-collection work and memory footprint. Reduce unnecessary allocations only after profiling; stack allocation, object reuse, batching, and representation changes can help, but manual pooling can also increase retention and complexity.

Loading helpful count