A simple Go error handling pattern led to 54GB memory usage with 65535 errors

2 alingse 1 6/18/2025, 2:29:41 PM gist.github.com ↗

Comments (1)

alingse · 4h ago
While debugging why our golangci-lint runs in CI were getting randomly killed, I discovered a surprising memory issue in Go's error handling.

The problem occurs when combining many errors using `errors.Join()` and wrapping them with `fmt.Errorf()`. Here's a minimal reproduction