ToolTip is leaking memory

Use this forum to read, ask or inform about memory issues in the .NET Framework and third party components.
Joined:Tue Dec 08, 2009 4:51 pm
ToolTip is leaking memory

Post by 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

        if (disposing && (components != null))

Any suggestions are welcome.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest