What are the challenges you face when working across database platforms? Take the survey
Options

Success story and tips for debugging Win Forms

homologicushomologicus Posts: 2
edited December 23, 2016 12:52PM in ANTS Memory Profiler 8
Gentlemen/Ladies, my compliments on a great product. I was debugging a leak in a Windows Forms application and the instance retention graph actually led me to a particular line of code! It wasn't even my code, and I was able to identify the line that caused the problem, just from working in ANTS. I have no idea how we would have identified the problem without it. It would have cost a fortune. ANTS paid for itself in just that single bug.

I have a few of these WinForms leaks under my belt now and thought I'd share my lessons learned:

* I know this is no great insight, but static events are the root of many managed leaks. Be very suspicious of them when debugging.

* When working in a WinForms application, watch objects of type System.Windows.Forms.PropertyStore. They are used heavily in the WinForms code and almost anything that you leak in WinForms will show as a large number of PropertyStore objects leaking. You can follow their retention graph up to the culprit in your code.

* You can really effectively narrow down your problem by varying your "steps to reproduce" and watching what happens in ANTS. I found a key clue by disabling an option in our application. I disabled the option, re-ran the steps and, no leak.

HTH somebody.
Tagged:

Comments

Sign In or Register to comment.