windows forms leak

  • Thread starter Thread starter Vyacheslav Lukianov
  • Start date Start date
V

Vyacheslav Lukianov

Hello,

I've created a windows application with custom message loop, without using
an Application.Run method, and got all my forms not garbage-collected. Profiler
shows that forms' instances are referenced only by their own event handlers.
Clearing them manually helps, but this solution is not applicable for all
forms which can possibly be created inside the process. Can this somehow
be worked around?

Thanks,

--
Best regards,
Vyacheslav Lukianov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"
 
I think this is because
System.Windows.Forms.Application.AddMessageFilter(...) holds a reference to
your form. You should put somewhere RemoveMessageFilter
 
Hello Giedrius,

G> I think this is because
G> System.Windows.Forms.Application.AddMessageFilter(...) holds a
G> reference to your form. You should put somewhere RemoveMessageFilter

Thanks for the reply! But the problem appeared not related to custom message
loop. Actually, we've discovered one more bug in Windows Forms. Briefly,
ListView.Dispose() doesn't unhook all event handlers from imagelists, which
are attached to the listview. So these imagelists do keep references to forms
containing such listsviews. Here is detailed description: http://blogs.jetbrains.com/yole/archives/000037.html.

--
Best regards,
Vyacheslav Lukianov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"
 
Back
Top