Stacktraces with CRTDBG memory leaks on Windows - #3202
Conversation
|
I think this is ready for review now. |
|
This is pretty exciting. Love seeing the leak output on AppVeyor. It looks like the leaks test needs an |
There was a problem hiding this comment.
I think it'd be a bit more idiomatic libgit2 to declare our own struct with SYMBOL_INFO as the first field and the buffer just after that, though I suppose we don't really do quite this anywhere else.
There was a problem hiding this comment.
Yeah that's clearer. I'll update it.
|
@jeffhostetler 💎 😍 |
|
Thanks. I've got one more thing I want to try/fix with checkpointing before I wrap this up. I'm on vacation for the next few days, so I might not get back to it until then. Also, anyone have interest in having the containing C# stack trace when called by LG2# and included in the de-dup calculation? I don't currently know how to get this natively from C, I can investigate this if there's interest while here. |
I do. I'm not sure we could run this as part of the CI build, though. However, I'd happily volunteer to write a .ps1 script that would clone libgit2, build it with the special flags and run the libgit2sharp against it. This script may be run locally for now. |
|
I've updated this to include routines to do check points. You might use this around an individual test, for example. I've a commented out example in clar_libgit2_trace.c showing it used around a "suite". It does suffer from a few false positives because of TLS data that isn't freed until the thread/process finishes, but it might be helpful in some instances. Also, I've included a set of "aux" routines to let a consumer (like LibGit2Sharp) register callbacks and give us the C# stack trace of allocs / leaks (since my C code doesn't cross the PInvoke boundary). This allows the C# data to be independently de-duped in C#. It makes no assumptions about C#, so it should be usable by other interpreted languages. I'll push up a PR over in LG2# in a minute that uses this. |
|
I just rebased this onto the current master. It now shows only 3 leaks remaining when running the clar tests. |
Stacktraces with CRTDBG memory leaks on Windows
Added routines to generate a stacktrace within libgit2 on Windows using the system debugger APIs.
Updated CRTDBG memory leak reporting to include de-duped stack traces of each unique leak.
To simplify things I just combined these new features under the original MSVC_CRTDBG define.