C/C++ Programming - Windows Memory Leak Analysis using DebugDiag

DebugDiag one of the simple tools which has helped me in analyzing memory leaks for Windows. Once we enable the tracker to monitor for memory pressure analysis we can generate memory dumps for corresponding process and do an Analysis to get the stack trace, allocation count and memory leak probability. We can also get the dependent DLL specific memory as well, which helps in narrowing down issue to a module.

Following are the steps which i follow during analysis of a memory leak issue on windows using the debugdiag.


  1. build the binary or module in debug mode

  2. make sure that binary/module PDB file is also generated. Which can be enabled by using /PDB option of link.exe.

  3. deploy the debug binary along with PDB file on the env on which we have to do the analysis

  4. start the process (supposing that this would be a server class program)

  5. start DebugDiag and select the server app to be tracked for "Memory and Handle Leak"

  6. keep doing the operation which results in memory leak for few hours

  7. Under "Processes" tab within DebugDiag right click the server program and select "Create Full Memory Dump"

  8. Then do the analysis using that data file. (How to use the Debug Diagnostics 1.0 tool to analyze a memory dump file)



NOTE: Make sure that the symbol directory configured for DebugDiag points to the folder which contains the necessary PDB files. The folder to search for symbol files can be configured using Tools->Options and Settings->Symbol Search Path For Analysis

Labels: , , ,

Posted by - at 12:15 am | 0 comments read on

Archives

  • May 2011
  • February 2009
  • December 2008
  • November 2008
  • October 2008
  • August 2008
  • April 2008
  • December 2007
  • November 2007
  • January 2007
  • December 2006
  • October 2006
  • September 2006
  • June 2006
  • May 2006
  • April 2006
  • March 2006
  • February 2006
  • January 2006
  • December 2005
  • November 2005
  • October 2005

Links