I'm investigating potential memory leaks in some internal services, currently running Go 1.5.3 (upgrading to 1.7x in our next deployment). I've already tracked down one 3+GB 'leak' in BuckHashSys, which we've worked around with GODEBUG=memprofilerate=0 for now, while we consider rewriting some internal data structures to use iteration rather than recursion in order to ensure consistent profile stack traces / bound our BuckHashSys memory overhead.
Now I'm observing an increase in HeapAlloc (and corresponding HeapInUse/HeapSys values) over time. I'd appreciate any help verifying/correcting any of my current understanding/assumptions: * HeapAlloc values represent data allocated and still 'in use' by our code, where 'in use' is somewhat loosely defined (may include unreferenced objects that haven't been noticed/freed following GC mark/scan). Immediately following a GC though, HeapAlloc should accurately represent our current memory footprint. If post-GC HeapAlloc values continue to climb, we are referencing more memory somewhere. * HeapIdle only represents fully idle/empty spans. Post-GC, a single reachable object may be the only thing keeping an entire span 'alive', and that full span would be accounted for in HeapInUse, while only the size of that one reachable object in the span is counted in HeapAlloc. * The process of freeing memory to the OS is controlled by the scavenger, which responds to OS memory pressure; and released memory may or may not be reclaimed by the OS. Overall this is more 'non-deterministic' than the GC itself, but the GC itself is still deterministic/precise. If we see HeapAlloc increasing, OS memory pressure and the scavenger process should be unrelated. Before we continue chasing down the increase in HeapAlloc I wanted to confirm those assumptions; if there is some internal runtime GC behavior that may be less aggressive at freeing objects when there isn't notable OS memory pressure then I'll need to factor that in. -- 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. For more options, visit https://groups.google.com/d/optout.