title: How to use WinDBG to track down .net out of memory exceptions?
body: <p>I need to track down the reason for out of memory (OOM) exceptions in a .NET application. Using perfmon, the app crashes with an OOM when using relatively low memory (500-700mb), so I'm assuming some sort of heap fragmentation.</p>
  
  <p>After researching it looks like WinDBG is the tool to use to track this kind of problem down. I've set up DebugDiag on the server running the processes. I've also managed to load the dump from DebugDiag into WinDBG, hook up the symbol server and my own private symbol files and it all seems to work - I can run commands like <code>!clrstack</code> and <code>!dumpheap -stat</code> and I'll see my class names listed.</p>
  
  <p>The problem I have now is I don't know how to approach the problem of tracking down where the fragmentation is. WinDGB has a lot of commands with a lot of different flags and options and I'm not sure which ones I should be using. I couldn't track down a good tutorial on what to do either - most are really basic around getting WinDBG up and running.</p>
  
  <p>Could someone point me in the right direction?</p>