Go 1.24 Memory Leak Investigation: An Unexpected Discovery and the Swiss Tables Surprise

After the release of Go 1.24, an unexpected memory usage increase was observed in a data processing service. Investigation revealed that a refactoring of a memory allocation function in the Go runtime inadvertently removed an optimization, causing unnecessary zeroing of memory during large object allocation, thereby increasing Resident Set Size (RSS). While Go runtime internal metrics showed no change, system-level metrics revealed a significant increase in memory usage. Collaboration with the Go community helped pinpoint and fix the issue. Surprisingly, Go 1.24's new "Swiss Tables" feature significantly reduced memory usage in high-traffic environments, offsetting the previous regression and even yielding additional memory savings.