I was recently involved in tracking down a memory leak in a .NET Windows Service and I wanted to summarize the process we went through. This is really an aggregate of a number of other people’s posts that are referenced at the end of this post.
Firstly, get your machine set up:
Secondly, capture a dump from the leaking process (you typically want to do this when the process has been running for a while and has shown signs of the memory leak):
Thirdly, analyze the dump to find what types are consuming the most space in the process’s memory:
This usually gives you enough information to then go back to your source code and investigate the root cause of the memory leak with more direction…