Re:How we analyzed and fixed a Golang memory leak
by otterley on Wednesday March 23, 2022 @10:05PM
(#30785726)
This fix did not address an actual memory leak (i.e., growing heap) in the Go runtime as the headline suggested; it instead was a change in the Go runtime to make Linux cache memory pages less aggressively. The underlying issue still remains, which is that in some cases, Linux isn't evicting cached pages to stay within cgroup memory limits.
Re:How we analyzed and fixed a Golang memory leak
by infogulch on Wednesday March 23, 2022 @09:47PM
(#30785639)
> If you are using go between 1.12 to 1.15 within containers, you likely want to set GODEBUG=madvdontneed=1. :-)
This setting is default in Go 1.16+, which was published about 1 year ago. They don't mention what version they're using. The last several releases have landed some pretty significant improvements as I recall, maybe this is a good excuse to upgrade the Go release you use to compile your app.
Re:How we analyzed and fixed a Golang memory leak
by sharva on Wednesday March 23, 2022 @11:25PM
(#30786106)
Yes, as said "In fact, go 1.16 has reverted to using this as the default now. The memory graph after this change looks much better and steady at 2G.". Upgrading is definitely next, not easy though since Google appengine flex still does not supported 1.16 out of the box https://cloud.google.com/appengine/docs/flexible/go/runtime
I believe this is fixed when cgroup v2 is used.
This setting is default in Go 1.16+, which was published about 1 year ago. They don't mention what version they're using. The last several releases have landed some pretty significant improvements as I recall, maybe this is a good excuse to upgrade the Go release you use to compile your app.