lunes, 13 de junio de 2011

How to analyze a dump file?

First at all, you need to install DebugDiag.exe.
This tool enables to analyze any memory dump file. Basically, there are two analysis methods:
1. Crash/Hang Analyzer
Examines the memory health, threads, memory allocations and any assembly loades by the process as well.
2. Memory Pressure Analyzer
This is the most important analysis, because gives us a very good detail of How many assemblies are loaded and its memory size (Consumption).
You will be able to analyze which components are the most expensive related with the memory allocation.
1. Creat a dump file.
To do this, you can use windows task manager, select the process to be analyzed and create a dump file.
2. Open dump file with DebugDiag.exe
When you install DebugDiag, it will be configured like the default program to open *.dmp files.
3. Two analysis options will be displayed, both were quickly defined above.
4. Take a look of the reports generated by the tool (option 2).
5. This report will show a list of assemlies loaded in memory. You can see, which are the most expensive.
With this information you can go through your code and check the current implementation. You will notice how this assemblies are handled in the code and make some improvements on them.
For more details, you can use WinDBG.
Obviouslly, thi tool is a little bit more complex and requires a good understanding of memory allocation, etc.