I want to hear if anybody has an idea on how I can find a very small memory leak in a Go program? The program is a service running for days and weeks. I am not even 100% sure there is a memory leak, but when I look at the memory usage graphs based on data from runtime.ReadMemStats it looks like that possibly there is. As far as I can tell this would be the optimal way to find the leak:
- Let the program run for 1 day - Make a memory dump A using debug.WriteHeapDump - Let the program run for 1 additional day. - Make a memory dump B using debug.WriteHeapDump - Let the program run for 1 additional day. - Make a memory dump C using debug.WriteHeapDump >From these dumps, create a list of all objects which are in present in B and C but not in A. These would be long-living objects which are allocated long after the program started. And this will kind of be the definition of a leak in my program. Now, it seems like there are not really any tools supporting debug.WriteHeapDump so I don’t think this is possible without creating such a tool myself? The canonical way to find memory leaks seems to be the performance profiler https://github.com/google/pprof/blob/master/doc/README.md. But as far as I can see, it is not really useful to find small memory leaks like the one I describe? Maybe if I run my program for a very long time the leak would contribute to a non-trivial amount of memory currently allocated. Still, the amount of memory *allocations* that contribute to the leak would be very small. Would there be a way to use the performance profiler in this case? Any hints would be appreciated, thanks! -- 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/58da47fd-64a3-42f8-98ff-b76a6b936c9bn%40googlegroups.com.