Go 1.26: Green Tea GC becomes default, heap behavior analyzed

Original: Watching Go's new garbage collector move through the heap

Why This Matters

Go's default GC change affects runtime memory efficiency for all Go applications in production.

Go 1.26 made Green Tea the default garbage collector. Writer Phil Eaton uses perf and heap visualization tools to observe cache-friendliness improvements and exposes a known limitation: the non-moving collector cannot reclaim sparse heap pages.

Go 1.25 introduced Green Tea, a new garbage collector, and Go 1.26 made it the default. In a technical deep dive published July 19, 2026, Phil Eaton examines how Green Tea behaves in practice by writing benchmark programs in Go and C# that allocate objects of three sizes (32, 64, and 128 bytes), then walk heap addresses to visualize layout.

Go uses size-segregated allocation—objects are rounded to a size class and placed within contiguous 8KiB spans, a design inherited from tcmalloc. Eaton uses Linux perf to measure cache-friendliness, showing programs that allocate same-typed objects in tight loops benefit most from Green Tea's improved locality.

However, Eaton also identifies cases where Green Tea provides no benefit: because Go's collector is non-moving, it cannot compact the heap. When allocations are sparse across many pages, pages cannot be freed even if mostly empty, leaving heap fragmentation unremedied. This is described as Go's 'residual garbage collector bugaboo.' The article includes working code samples for both Go and C# to reproduce the heap-visualization experiments.

Source

theconsensus.dev — Read original →