What go version are you compiling with?

go prior to 1.16 would hold onto memory such that the OS would only reclaim 
it when under memory pressure; it could be made to free memory eagerly 
using GODEBUG=madvdontneed=1.  This was made the default in go 1.16.

https://discuss.dgraph.io/t/benchmarks-using-godebug-madvdontneed-environment-variable/7322
https://go.dev/doc/go1.16#runtime

On Saturday, 29 January 2022 at 01:02:18 UTC eric.h...@gmail.com wrote:

> I've been trying to root cause an OOM condition.  My process is running 
> within a cgroup with a 4gb limit.  Occasionally that limit gets hit.  I 
> added a cgroup listener to watch for memory usage and create a pprof and 
> core dump.
>
> The pprof shows just a few hundred megs of "in-use" memory, however when I 
> open the core dump with viewcore I'm seeing around 3.3gb of free spans that 
> are being retained.  "kept for reuse by Go"..
>
> I've got GOGC set to 50 -- but my understanding is that just controls when 
> a GC kicks off -- not when memory will be returned to the OS.   
>
> Is there some sort of behavior a program can do to create this type of 
> situation?  or a way to give a hint to the GC  .. "hey... give it back!" 
> :)   
>
> Thanks for any ideas or thoughts!
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/853d8733-3f96-4ef4-82c7-848d13144212n%40googlegroups.com.

Reply via email to