NOTE
Go Memory Management
Stacks, heap, allocation, escape analysis, garbage collection, and observable memory metrics.
This is a historical learning note and may contain outdated or incomplete understanding.
Go combines growable goroutine stacks with a garbage-collected heap. The compiler decides whether values can stay on a stack or must escape, while the runtime allocator and GC manage heap objects.
When diagnosing memory, distinguish live heap, reserved runtime memory, goroutine stacks, native/cgo allocations, mapped files, and process RSS. High RSS is not automatically a Go heap leak. Profile allocations and object retention before tuning GC or introducing pools.