I'm using UMDH(x64) to test memory leak. My code is neither FPO optimized nor using customized allocators. It uses just "new" operator.
"Create User Mode stack trace Database" is enabled in the Gflags(x64) for the image that's being tested.
I have tracked my application using UMDH both in non-leaky case and leaky case and obtained the logs in both the cases.
And compared the logs with UMDH. It has picked the right pdb as evident from its comment lines in the top.
Problem:
The call stack doesn't show my code's stack. It just traces generic windows functions names. I have tried with both debug and release versions in x64. Am I missing something?
The code and diff trace obtained are below:
// code:
#include <iostream>
using namespace std;
void myFunc()
{
int k;
cin >> k;
int* ii = new int[1998];
if (k == 0) delete[] ii;
}
int main()
{
myFunc();
return 0;
}
// stack trace obtained:
+ 390 ( 390 - 0) 1 allocs BackTraceAC905E8D
+ 1 ( 1 - 0) BackTraceAC905E8D allocations
ntdll!RtlpCallInterceptRoutine+0000003F
ntdll!RtlpAllocateHeapInternal+0000069F
ntdll!TppWorkerThread+00000ADB
KERNEL32!BaseThreadInitThunk+00000022
ntdll!RtlUserThreadStart+00000034
.....
.....
...
As described in Using UMDH to Find a User-Mode Memory Leak (MSDN), you need to define the environment variable _NT_SYMBOL_PATH
before using UMDH.
If you run it from command line, use
set _NT_SYMBOL_PATH=c:\mysymbols;srv*c:\mycache*https://msdl.microsoft.com/download/symbols