Company
Date Published
Author
Nayef Ghattas
Word count
1848
Language
English
Hacker News points
None

Summary

In early 2025, the release of Go 1.24 introduced the Swiss Tables map implementation, promising reduced CPU and memory usage, but unexpectedly resulted in a 20% increase in memory consumption across several environments. Upon investigation, the increased memory usage was traced to a subtle regression in the memory allocator introduced by a runtime refactor, which caused more virtual memory to be committed to physical RAM, leading to higher resident set size (RSS) without affecting Go's internal metrics. The root cause was identified as the removal of an optimization in the mallocgc function, which previously avoided unnecessary zeroing of memory when allocating large objects containing pointers. This oversight was rectified with the help of the Go community, and a fix was implemented to restore the optimization in Go 1.25. The investigation not only resolved the issue but also revealed that in high-traffic environments, the new Swiss Tables implementation significantly reduced memory usage, demonstrating the complex interplay between runtime changes and memory management.