Salesforce

How Do I Use the User-Mode Dump Heap (UMDH) to Debug Magic xpi? (Magic xpi 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Use the User-Mode Dump Heap (UMDH) to Debug Magic xpi? (Magic xpi 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.

To use the User-Mode Dump Heap (UMDH) to debug Magic xpi, follow these steps:

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

    http://archive.msdn.microsoft.com/debugtoolswindows/Release/ProjectReleases.aspx?ReleaseId=4912

    You should download a file called dbg_x86_6.12.2.633.msi.

  2. Open a command prompt and open the Debugging Tools for Windows installation directory, usually %ProgramFiles%\Debugging Tools for Windows\ (in a 64bit OS you need to add the "(*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 xpi 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.

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

Reference
Attachment 
Attachment