Using the User-Mode Dump Heap (UMDH) to Debug Magic (Magic xpa 3.x)
Memory leaks can be hard to trace. Microsoft has provided developers with a useful utility that works with the operating system to analyze Windows heap allocations for a specific process.
This utility, called UMDH (User-Mode Dump Heap) is part of the Debugging Tools for Windows. The general usage would be to take a snapshot of the memory state in a "quiet mode", reproduce the memory leak and take another snapshot, and then compare the two shots.
This technical note explains how to use the UMDH with Magic xpa.
To use the UMDH tool, carry out the following steps on the machine where Magic xpa is installed:
Download a copy of the Debugging Tools for Windows from: http://archive.msdn.microsoft.com/debugtoolswindows/Release/ProjectReleases.aspx?ReleaseId=4912.
You should download the dbg_x86_188.8.131.523.msi file.
Open a command prompt and open the Debugging Tools for Windows installation directory, usually %ProgramFiles%\Debugging Tools for Windows\.
In a 64-bit operating system you need to add (*86).
Define an environment variable _NT_SYMBOL_PATH to point to the directory of the PDB files.
Enable the user stack trace: gflags -i +ust.
Note: You can also do this via the global flags UI.
Start the runtime engine. Then run the Magic xpa application/server.
Reach a starting point. After running the executable, go through tasks that you plan to use again.
Make a snapshot, calling the file begin.txt: umdh -p: -f:.
For example: umdh -p:1234 -f:d:\temp\begin.txt
Run the same programs a few more times to create a memory leak, and then reach the same open windows state that existed when you ran the first snapshot.
Again, create a snapshot, this time called end.txt:
umdh -p:1234 -f:d:\temp\end.txt (This is a different file this time.)
Now run a comparison between the files: umdh -d d:\temp\begin.txt d:\temp\end.txt -f:d:\temp\diff.txt.
Send the diff.txt file.
Disable the user stack trace: gflags -i -ust.
Using Debugging Tools to Debug Magic xpa