Tuesday, June 28, 2011

Memory leaks - part 3

Last time I talked about UMDH to find memory leaks in the user-mode heap. This tool probably covers 95% of memory leaks, but there are other ways to leak memory. I wouldn't be surprised even people who are very familiar with UMDH haven't heard of today's utility. It's a tool from Microsoft called LeakDiag.

LeakDiag is like UMDH in that it takes snapshots of a running program and differences them to show you potential leaks. Whereas UMDH only looks at the user-mode heap, LeakDiag looks at the user-mode heap and so much more. LeakDiag can analyze 6 different areas:

  1. Virtual memory (VirtualAlloc, VirtualFree, etc.).

  2. Heap memory (the same as UMDH).

  3. MPHeap memory (the multi-processor heap).

  4. COM memory.

  5. COM private memory.

  6. C runtime memory.


You might be asking yourself, if LeakDiag does more than UMDH, why would you ever use UMDH? As I said earlier, most memory leaks occur in the user-mode heap, and UMDH is specifically designed for the user-mode heap so it does a better job at finding and displaying those leaks. So I would recommend using UMDH first, but LeakDiag is a powerful tool to be aware of in case you need it.

No comments:

Post a Comment