Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Odd performance degradation in application

We have an application that is mixed .NET 2.0 and native C++. In our testing, we have a mode which can automatically loop through a set of projects. A project opens, runs, closes, repeat. Each of these steps requires creation/destruction of windows (winforms to be precise). Recently we've experienced some odd behavior in performance. After running for a few hours the opening and closing parts slow down (blocking the gui thread and showing half drawn screens etc). Now it would be easy to chock this up to a resource leak...but we're tracking handles and memory, and while memory grows slightly there's nothing to indicate this level of problem. Handles are stable. So maybe dangling event handlers...still need to investigate that. But the kicker, which perplexes me, is that shutting down the application and restarting it doesn't bring back the initial performance. It's still slow until I reboot the OS (win XP) and then performance starts out snappy again. This really perplexes me as I assume shutting down the application will reclaim all resources. Any thoughts?

like image 549
user109078 Avatar asked Nov 15 '22 14:11

user109078


1 Answers

Sounds like a possible GDI handle leak. GDI objects are not automatically picked up by the Garbage Collector.

.NET Memory Profiler (http://memprofiler.com/) does a good job of tracking these (there is a 14 day trial version).

Have you seen these:

  • Resource Leaks: Detecting, Locating, and Repairing Your Leaky GDI Code

  • Detect and Plug GDI Leaks in Your Code with Two Powerful Tools for Windows XP (has a link to a GDI Handle viewer tool).

like image 174
Mitch Wheat Avatar answered Dec 27 '22 02:12

Mitch Wheat