Best Practices for Diagnosing Messaging Server Memory Leaks

If messaging server (iMO) performance degrades to the point that you suspect memory leaks, you can use several Microsoft Debugging Tools to gather and analyze data.

Most of the messaging server components run under OBMO.exe. This document provides information on how to analyze or track any potential memory leak in OBMO.exe. OBMO loads and runs both unmanaged ( .NET) and managed (C++) modules. Some of the components employ techniques that intentionally do not free memory for re-use later. When there is sudden increase in concurrent requests, the memory may appear to build up. Since these behaviors are highly dependent on the size of the payloads used and amount of traffic, it is hard to provide guidance on the pattern for a specific installation. The presence of .NET components also make it harder to estimate.

In installations where it is suspected there is a potential memory leak, the information provided in this document can be used for investigating potential memory leaks. This document focuses on analyzing leaks in managed modules.

The tools needed for analyzing memory leaks are Windbg, GFlags and UMDH. All these come from Microsoft Debugging Tools, which is available for download and install from Microsoft’s web site. It is important to note that, OBMO is a 32 bit application and tools that are available for 32 bit specific work best, particularly the windbg, if 32 bit version is used for capturing and analyzing, provides best results.
Microsoft Debugging Tools
Tool Description
GFlags GFlags, among other things, allows capture of memory allocation stack trace. Once a suspected memory allocation is found, if GFlags is enabled, it is possible to get the stack trace for the code that allocated the memory. The drawback is that once enabled, since the process needs to keep track of the allocations, it uses up additional memory and processing. When GFlags is enabled, the memory growth is more rapid. So, it is not recommended to run the service for extended periods of time. Once the required captures are complete, the GFlags stack trace should be reset.
Windbg

Windbg is a Microsoft debugging tool that is useful for live process analysis or process dump analysis. For the purposes of memory leak detection, process dumps with full memory information will be used. Since full memory information is used the created process dumps may be huge. The size of the expected process dump may be estimated by looking at the virtual bytes counter in perfmon for OBMO.exe. It is expected to be closer to that counter.

With GFlags enabled process dump, it is possible to get memory allocation call stack.

UMDH Using the UMDH tool, it is possible to create memory allocation snapshots. After creating multiple snapshots between intervals, it can be used to compare the snapshots to get report of allocations that are new between captures. By analyzing multiple samples, possible leaks can be identified.