Hasty Briefsbeta

Bilingual

Watching Go's new garbage collector move through the heap

7 hours ago
  • Go 1.26 made Green Tea the default garbage collector, improving cache-friendliness.
  • Go's non-moving GC lacks compaction, causing memory fragmentation and inability to reclaim sparse pages.
  • Experiments show Green Tea GC reduces L1 cache misses and improves performance despite higher L3 miss rates.
  • Manual copying can simulate compaction in Go to reduce fragmentation, unlike C#'s automatic compacting GC.
  • Go allocates same-size objects together in spans, while C# interleaves objects of different sizes.
  • Green Tea GC scans spans for pointers instead of following each pointer, reducing random memory access.