Primary Navigation

Tech Off Post

Single Post Permalink

Let's say I have a managed C# test application that is used to test a native C/C++ API. Now I am suspecting that there is a memory leak somewhere in the C/C++ code. What I need to do is be able to calculate the amount of memory that is allocated by the native code. It doesn't need to be super accurate, but being able to see whether this value is going up or not based on different tests I'm running on the native code would be helpful.

I tried calling GC.GetTotalMemory(true), but the value it returns is substantially lower than the value shown for the process in task manager. I suspect the value returned by GetTotalMemory is just for your managed application, while task manager shows total .Net VM memory.