Watching Go's new garbage collector move through the heap
- Programming
- Infrastructure
- Performance
- Developer Tools
The post visualizes how Go’s garbage collector moves through the heap, contrasting the older collector with the newer page-oriented design so you can see what gets scanned and why. The useful context is that Go does not rely on a classic compacting collector. Its allocator groups same-sized objects into spans built from 8 KiB pages, and large objects live separately. That means small-object fragmentation does not usually block a later large allocation the way people often imagine.
If you run Go at large heap sizes, the operational question is less "does it compact" and more "how do size classes, page locality, and VM settings affect memory retention and translation overhead." Watch for cases where long-lived objects pin pages, and benchmark huge page settings instead of inheriting old blanket advice to disable them.
-
theconsensus.dev
- Discuss on HN