Does recent bug in debug.FreeOSMemory also affect automatic background scavenging?

134 views
Skip to first unread message

john...@gmail.com

unread,
Mar 11, 2020, 7:35:51 PM3/11/20
to golang-nuts
I see this bug was recently fixed in FreeOSMemory: https://go-review.googlesource.com/c/go/+/208960/

Does the same bug also affect the scavenging that automatically happens every 5 minutes?  Asking because we are seeing high memory usage, in an app that has (until now) avoided calling FreeOSMemory and just relied on the automatic 5-minute cleanup.

John

Ian Lance Taylor

unread,
Mar 11, 2020, 8:35:54 PM3/11/20
to john...@gmail.com, mkny...@google.com, golang-nuts
[ +mknyszek ]
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/bb4bb2e7-9253-4034-b25f-6c1759b8d7dd%40googlegroups.com.

Michael Knyszek

unread,
Mar 11, 2020, 10:35:26 PM3/11/20
to Ian Lance Taylor, john...@gmail.com, golang-nuts
Hi John,

If you're referring to scavenging that kicked in every 2.5 minutes and returned spans which had been unused for 5 minutes, that's been replaced with an asynchronous, continuous mechanism as of Go 1.13 (https://github.com/golang/go/issues/30333). This policy is generally more aggressive than the old one, so if you're seeing an increase in memory use it's probably coming from something else. Do you know if this is an actual increase in heap objects allocated (a GC trace would tell you (GODEBUG=gctrace=1), also MemStats.HeapAlloc) or is that roughly the same and the increase is only in OS-reported RSS?

This new policy was also unaffected by the aforementioned bug.

Please file an issue (https://github.com/golang/go/issues) and I'd be happy to look into it. This isn't the first instance of an increase in memory use we've seen in the issue tracker for Go 1.14, but right now it's hard to tell where it's coming from. It doesn't appear to be the scavenger in any of those other instances, also (AFAICT so far).

Thanks,
Michael

john...@gmail.com

unread,
Mar 11, 2020, 10:41:22 PM3/11/20
to golang-nuts

Thanks Michael, 

That's super-helpful in helping us understand what to look for, and what not to look for.

I can't easily get sufficient data to file an issue right now, because the behaviour has only been reported in a customer environment that I don't have access to.  For that reason I can't even prove, yet, whether its a change in behavior or not.  Your reply makes it seem less likely to be a change, and more likely to be something else that was always there in our app but not previously reported.   If we get further into the investigation, and it does turn out to be a change in behaviour from the Go runtime, I'll definitely file an issue.

Thanks again for your answer.

John
> To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages