Tech Off Post

Single Post Permalink

View Thread: Finding memory leaks in native code when P/Invoking
  • User profile image

    @Ion Todirel:

    Thanks for the suggestions, I'll try some of those. The code I'm testing is a large C API written in C/C++. I did not write 98% of the code so yea I can't vouch for it being "appropriate" in all cases Wink

    Basically all I need to do is find a reliable way to tell the total amount of memory used by the native code. This way I can tell whether the native memory usage is going up or not over time, and whether a certain code fix resolved the remaining memory leaks.

    From what I can tell, it appears I fixed the last of the memory leaks yesterday, so this may not be such a big issue at this point. Still for academic and future purposes I would like to know of a reliable way to measure memory used by the unmanaged code.

    BTW this is the only thing I found that a managed test driver is not good at. The C# test application I'm using is quite complex and if I needed to write it in C/C++ it would not have been anywhere close as feature-rich and easy to maintain/expand as it is now.