ToolTip is leaking memory

Use this forum to read, ask or inform about memory issues in the .NET Framework and third party components.

Moderator: SciTech Software

ToolTip is leaking memory

Postby Nalin » Fri Dec 18, 2009 4:42 pm

While testing my application, i found that System.Window.Forms is leaking memory. So, i just wanted to share this finding in the known memory leaks area.

Its not that dangerous though, but if you have lots of ToolTips on your forms and their tips (messages) are changing dynamically then chances of your application crashing increases.

Microsoft says they fixed it long time back in .Net 2.0. But i can see its still leaking in some cases. In my case, we have a windows base UserControl and inside that a ToolTip was getting created.

Code: Select all
ToolTip newTip = new ToolTip();
newTip.SetToolTip(lblOwner, lblOwner.Text);


I fixed it by adding newTip.RemoveAll() in the Dispose of my UserControl.

Code: Select all
protected override voide Dispose(bool disposing)
{
        //Nalin Bhatia
        newTip.RemoveAll();

        if (disposing && (components != null))
        {
             components.Dispose();
        }
   
         base.Dispose(disposing);
}


Any suggestions are welcome.
Nalin
 
Posts: 2
Joined: Tue Dec 08, 2009 4:51 pm

Return to Known Memory Issues

Who is online

Users browsing this forum: No registered users and 1 guest

SciTech Software logo

© Copyright 2001-2016. SciTech Software AB
All rights reserved.


SciTech Software AB
Kartvägen 21
SE-175 46 Järfälla
Sweden


E-mail: mail@scitech.se

Telephone: +46-706868081

cron