Respecting Memory Limits In Go
summary
Go 1.19 adds a soft memory limit that enforces a total-process cap (heap plus runtime metadata), can return memory to the OS, and lets GOGC be driven by absolute limits rather than only a ratio. A demo shows thrashing when the limit approaches live heap (example: live 40 MB, GOGC changes push GCCPU to ~55%), so the implementation throttles GC CPU to avoid stalls (goal: ≲2x slowdown worst case). Recommended workflow: pure-Go container, set gogc=off, give 5–10% headroom.
AI-written summary · about
chapters (6)
- 0:00Start
- 0:48What Is the Memory Limit Feature
- 1:34The Go Garbage Collector
- 12:39Memory Limits
- 21:32Rules of Thumb
- 25:53Gc Guide








