MDI Child Form Dispose?

A

Adam Right

Hi,

I am developing an application which has established on MDI Form and there
are many MDI Child forms. My problem is starting when i close the mdi child
forms. They are not disposed from the virtual memory, so it wastes much
memory for the clients. I trigger GC.Collect and i also implemet IDisposable
method for all object that i have created. But when i use a memory profiler
that shows the status of the current object for my application, i see that
there are many native controls and some objects that are not disposed from
the memory.

I use C# and .net framework 2.0, so have you met problem as same as my
problem? If you have suggestion it will very helpful for me. Thanks..
 
N

Nicholas Paldino [.NET/C# MVP]

Adam,

Do you set any methods on your MDI forms as event handlers for other
objects outside of the MDI form? If so, that could be extending the
lifetime of your MDI form.
 
A

Adam Right

Hi,

I have one MDI form and all other forms are its children. So if mdi form is
closing that means my application is closing. But my problem is about the
child form in which the native controls and some objects are not disposing.
In the profiler, i have seen that whenever i open a child form, the active
objects get more and more. Although i close and dispose the child form, the
native controls and some object remain alive.

When i close a child form, i also set the event handlers of the child form
to null. But as i said before in the memory i see always native controls
much.

Did you try that when you add many controls on a child form, and close it,
what happens on the virtual memory? In my application it remains same.

Thanks.

Nicholas Paldino said:
Adam,

Do you set any methods on your MDI forms as event handlers for other
objects outside of the MDI form? If so, that could be extending the
lifetime of your MDI form.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Adam Right said:
Hi,

I am developing an application which has established on MDI Form and
there are many MDI Child forms. My problem is starting when i close the
mdi child forms. They are not disposed from the virtual memory, so it
wastes much memory for the clients. I trigger GC.Collect and i also
implemet IDisposable method for all object that i have created. But when
i use a memory profiler that shows the status of the current object for
my application, i see that there are many native controls and some
objects that are not disposed from the memory.

I use C# and .net framework 2.0, so have you met problem as same as my
problem? If you have suggestion it will very helpful for me. Thanks..
 
A

Anca T

Hi,
I have the same problem and nothing seem to work, my memory gets bigger and bigger and the client more nervous. Please, if you have any conclusion or suggestions on this issue share it here.
I tried calling dispose on every tiny object I use, I removed all event handlers but no improvement what so ever.
Thanks
Anca
 
M

Mike Feder

I had the same problem and I went to a pool pattern. I never close the forms but only hide them and keep in a Form pool I created. It solves the memory problem but still creates a form handle any time you show again a pooled MDI child.



Anca T wrote:

MDI Child Form Dispose?
18-Jun-08

Hi,
I have the same problem and nothing seem to work, my memory gets bigger and bigger and the client more nervous. Please, if you have any conclusion or suggestions on this issue share it here.
I tried calling dispose on every tiny object I use, I removed all event handlers but no improvement what so ever.
Thanks
Anca

Previous Posts In This Thread:

MDI Child Form Dispose?
Hi

I am developing an application which has established on MDI Form and there
are many MDI Child forms. My problem is starting when i close the mdi child
forms. They are not disposed from the virtual memory, so it wastes much
memory for the clients. I trigger GC.Collect and i also implemet IDisposable
method for all object that i have created. But when i use a memory profiler
that shows the status of the current object for my application, i see that
there are many native controls and some objects that are not disposed from
the memory

I use C# and .net framework 2.0, so have you met problem as same as my
problem? If you have suggestion it will very helpful for me. Thanks..

Adam, Do you set any methods on your MDI forms as event handlers for other
Adam

Do you set any methods on your MDI forms as event handlers for other
objects outside of the MDI form? If so, that could be extending the
lifetime of your MDI form

--
- Nicholas Paldino [.NET/C# MVP
- (e-mail address removed)


Hi,I have one MDI form and all other forms are its children.
Hi

I have one MDI form and all other forms are its children. So if mdi form is
closing that means my application is closing. But my problem is about the
child form in which the native controls and some objects are not disposing.
In the profiler, i have seen that whenever i open a child form, the active
objects get more and more. Although i close and dispose the child form, the
native controls and some object remain alive

When i close a child form, i also set the event handlers of the child form
to null. But as i said before in the memory i see always native controls
much

Did you try that when you add many controls on a child form, and close it,
what happens on the virtual memory? In my application it remains same

Thanks

message
MDI Child Form Dispose?
Hi,
I have the same problem and nothing seem to work, my memory gets bigger and bigger and the client more nervous. Please, if you have any conclusion or suggestions on this issue share it here.
I tried calling dispose on every tiny object I use, I removed all event handlers but no improvement what so ever.
Thanks
Anca


Submitted via EggHeadCafe - Software Developer Portal of Choice
Image2HTML Image to HTML Conversion Reloaded
http://www.eggheadcafe.com/tutorial...aa-3582341d35bb/image2html-image-to-html.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top