Adi Drumea

Monday, November 07, 2005

[.NET] ToolTip resource leaks

Working on a .NET app. I've added tooltips to some buttons in a complex user control. The user control was so complex, it contained about 70 controls in it. Creating/destroying this user control multiple times would exhaust the GDI resources on my machine. I first inspected the problem with Process Explorer from Sysinternals (www.sysinternals.org) and found out it was eating user handles like crazy. Then I used a memory profiler for .NET (.NET Memory Profiler 2.6 by Scitech - http://www.scitech.se/memprofiler/), took some heap snapshots and manually inspected the leaking control instances. I finally found the problem to be a ToolTip control that is keeping references to objects. Then i googled the net and found the same problem being found about two years ago :)
To put it simple: one should remove tool tips (at some point) in order to get the whole form disposed.

0 Comments:

Post a Comment

<< Home