.NET Memory Analysis

One of the most frustrating challenges we have to deal with when we create an application is a memory related problem. These may actually manifest themselves as out of memory exceptions or possibly slow downs as the system waits for resources. Diagnosing the cause of these problems requires cunning and perseverance.

So how do you go about finding the offending piece of code when your application contains several layers and thousands of lines of code. The answer is to dig into your bag of wizard’s spells and exercise the demons to send them back to the beyond.

Ok, that is a little dramatic. The real answer is to get a profiling or analysis tool. There are several out there. Some are free. Of course the ones with all the bells and whistles will set you back the price of a few first person shooter games.

While I was doing some diagnosis recently I ended up working with Dev Partner’s Memory Analysis, Red Gate’s ANTS, as well as the CLR Profiler and DebugDiag from Microsoft. This is by no means a complete list of what is available, just what I have tried. They each have their strong points and aggravations.

Memory Analysis has a really nice real time graph of the memory being allocated system. This helps as you are stepping through code to tell you at what point you app becomes a pig. The problem is that it isn’t good at telling you which object is bellying up to the buffet.

For the detailed level and ease of reading I actually found that CLR Profiler did a nice job. The allocation graph gives you a tree diagram that is easy to follow and allows you to drill down when you find a point of interest.

In the end I found that this is a process that still takes a lot of basic troubleshooting skills. Changing your code to exercise different scenarios and building test apps to isolate suspected thieves are crucial tasks. I hope this little bit of information can help some of you out there if you run into this type of situation.

posted on Saturday, October 7, 2006 1:43 AM Print
# re: .NET Memory Analysis
Ruth Castillo
2/20/2008 3:30 PM

I'm tring to build an aplication to Analize memory, but i don't find any information about it, i want to know if you want to help me with it.

# re: .NET Memory Analysis
Tim Murphy
2/22/2008 8:39 AM
I am always interested in learning new things. Unfortunately I am already working on a number of projects, personal and work, which leaves me too little time to start another right now. I would love to see what ideas you are working on though.
# re: .NET Memory Analysis
sujit singh
5/30/2008 1:31 AM
where can I get Devpartner Studio Professional Edition. I need to try it before I make any decision of purchasing it
# re: .NET Memory Analysis
5/30/2008 5:41 AM
# re: .NET Memory Analysis
sujit singh
5/30/2008 6:03 AM
Hi Tim,

Thanks for the link. I have already filled the registaration form yesterday, but they haven't contacted me yet. May be because I am in India, they wouln't have.
So I still don't have luck with the software. Can u send me a link from where I can download it ? or can u send me the software itself via email (trial version).


Post Comment

Title *
Name *
Comment *  

Tim Murphy

Tim is a Solutions Architect for PSC Group, LLC. He has been an IT consultant since 1999 specializing in Microsoft technologies. Along with running the Chicago Information Technology Architects Group and speaking on Microsoft and architecture topics he was also contributing author on "The Definitive Guide to the Microsoft Enterprise Library".

I review for the O'Reilly Blogger Review Program

Technorati Profile
Tag Cloud