Dot Net

Syrinx .NET Development Blog
Need help on your project? info@syrinx.com, or toll free (888) 579-7469, press 1

News



Need help with your .NET Development project?

Syrinx works with clients throughout New England to architect, design, develop, and deploy .NET Applications. Working on fully outsourced projects, as part of your team, helping to train your team, or rescuing projects in trouble, we are comfortable doing it all. Projects from a couple weeks to several months in duration, reference clients available. Contact us today - info@syrinx.com, or toll free (888) 579-7469 and press 1 to speak to someone now!

Insight on solving memory leaks and performance problems.

In a recent project I worked on I had the opportunity to help the client troubleshoot memory leaks and performance issues on a call center type application. The application has been released in multiple iterations into production and the memory leak and slow performance are now becoming more and more of an issue as new functionality is added.

My assignment was simple, fix the memory leaks and improve performance. After doing some research online and experimenting with various techniques and products I was finally able to put together a process in place to address the task at hand. I used a profiler named Ants Profiler by Red Gate to aid in resolving memory issues. For the performance problems I used DotTrace. Both products advertised that they can do both but I found that they only excel in one area as mentioned above.

Ants Profiler did a great job at aiding in finding memory leaks but was pretty terrible for troubleshooting performance problems. With Ants I was able to analyze and identify memory leaks mainly by figuring out who is holding on to references to what. Understanding the design of the application was required to know what is supposed to be in memory and what is not supposed to during the life span of an application. The number one culprit that I found were events not probably being cleaned up (set to null). The performance of Ants Profiler is slow, very slow. Especially when code is loop heavy (ex for, while foreach etc), it seems to incur extra overhead during profiling. And because of this and other factors, the performance figures reported were not accurate, which made it not a good choice for performance troubleshooting. Ants Profiler tech support was of little help but the good news is they said a new version is coming that is supposed to resolve the problem. One feature I like about Ants Profiler is the ability to view the actual code in the GUI where the memory leak is occurring; it was pretty handy and convenient feature.

Due to the limited ability of Ants Profiler in troubleshooting performance issues I turned my head to DotTrace.  In default configuration DotTrace also reported inaccurate numbers, but after some tweaking in the settings, I was able to get accurate enough numbers to move forward. DotTrace reports performance figures in a tree like structure, I was able to drill down the classes and methods through the hierarchy to pinpoint the source of the performance problem. Each tree node includes the time on how long it took for each method to run. A good feature I found with DotTrace is its filtering functionally, I wanted to located all the web service calls and figure out how long they were taking, with the custom filters I was able to quickly do that. Performance issues found in the client’s application included events snowballing, in correct UI control population, incorrect usage of xml files and other.

After the project was completed, the business and call centers reported very noticeable performance increase in the application and the memory leak issue was eliminated.

Comments

No Comments