PC Review


Reply
Thread Tools Rate Thread

windows forms leak

 
 
Vyacheslav Lukianov
Guest
Posts: n/a
 
      22nd Feb 2005
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!"



 
Reply With Quote
 
 
 
 
Giedrius
Guest
Posts: n/a
 
      25th Feb 2005
I think this is because
System.Windows.Forms.Application.AddMessageFilter(...) holds a reference to
your form. You should put somewhere RemoveMessageFilter


"Vyacheslav Lukianov" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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!"
>
>
>


 
Reply With Quote
 
Vyacheslav Lukianov
Guest
Posts: n/a
 
      26th Feb 2005
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!"



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
memory leak using system.windows.forms.timer Gestalt Microsoft VB .NET 14 14th Feb 2009 05:11 AM
memory leak with forms roni Microsoft Dot NET Compact Framework 1 6th Nov 2005 07:48 PM
GDI object leak in forms Jamie Microsoft Dot NET Framework Forms 1 25th Oct 2004 10:43 PM
over 4297000000 of GDI objects in a Windows.Forms application! ListView's leak. Wiktor Zychla Microsoft C# .NET 13 18th Sep 2003 11:45 AM
over 4297000000 of GDI objects in a Windows.Forms application! ListView's leak. Wiktor Zychla Microsoft Dot NET Framework Forms 13 18th Sep 2003 11:45 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:53 PM.