Go memory management
summary
Course material drills into how the Go runtime and compiler decide heap versus stack allocation, demonstrating with short code snippets that a single pointer return or closure often forces heap promotion. It uses live compilation output and escape analysis diagnostics to show when objects become orphans on the heap, and reproduces the behavior with the Go compiler and the -gcflags="-m" option. Practical fixes are applied and verified by recompiling and observing allocation changes.
AI-written summary · about
