Using the User-Mode Dump Heap (UMDH) to Debug Magic (Magic xpa 2.x)

« Go Back


Created ByKnowledge Migration User
Approval Process StatusPublished

Using the User-Mode Dump Heap (UMDH) to Debug Magic (Magic xpa 2.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:

  1. Download a copy of the Debugging Tools for Windows from:

    You should download the dbg_x86_6.12.2.633.msi file.

  2. 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).

  3. Define an environment variable _NT_SYMBOL_PATH to point to the directory of the PDB files.

  4. Enable the user stack trace: gflags -i +ust.

    Note: You can also do this via the global flags UI.

  5. Start the runtime engine. Then run the Magic xpa application/server.

  6. Reach a starting point. After running the executable, go through tasks that you plan to use again.

  7. Make a snapshot, calling the file begin.txt: umdh -p: -f:.

    For example: umdh -p:1234 -f:d:\temp\begin.txt

  8. 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.

  9. Send the diff.txt file.

  10. Disable the user stack trace: gflags -i -ust.

Related Topics

Using Debugging Tools to Debug Magic xpa