On Thu, Dec 15, 2016 at 12:57 AM, Pablo Rozas Larraondo <p.rozas.larrao...@gmail.com> wrote: > I've seen this question asked before in the mail list but with no clear > answers. I'm just asking it again in case someone has come up with a new way > of doing this: > > Does anyone know about a good tool or method to detect memory leaks > happening on C code being called by cgo?
I'm not aware of any really nice tool to do this. clang's memory sanitizer may work (I think last time I looked the gcc equivalent was not capable of doing leak detection). You can override the system malloc with e.g. jemalloc which will give you more debug information than the system malloc. Unfortunately most allocators leak detection is done using an atexit handler and I didn't find a nice way to get Go to run these handlers in my application. It is possible to run jemalloc in a mode that dumps periodic heap traces to disk which you can then diff to figure out which parts of the heap are growing. -- 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.