Home All Groups Group Topic Archive Search About
Author
22 Feb 2005 5:56 PM
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!"
Author
25 Feb 2005 12:54 PM
Giedrius
I think this is because
System.Windows.Forms.Application.AddMessageFilter(...)  holds a reference to
your form. You should put somewhere RemoveMessageFilter


Show quoteHide quote
"Vyacheslav Lukianov" <l**@intellij.net> wrote in message
news:5661812e28c71b8c6e7381adfdfb4@news.microsoft.com...
> 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!"
>
>
>
Are all your drivers up to date? click for free checkup

Author
26 Feb 2005 1:32 PM
Vyacheslav Lukianov
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!"

Bookmark and Share