c# memory leakage

L

lolarak_pandey

hi,
i have written a c# program ,in which i have multiple forms.
when i start the application ,the main form opens ,from which iam
calling another form using showdialog(this) method. after that from the
second form iam calling the third form ,again using the same
method,like this iam calling seven forms one after the other, in the
last again i am coming on the main form, this thing is continuous.each
form
now the problem is that each time new form open,memory uasge
increases,this thins thing repeats continuously,due to which when run
the same application two -three times,memory usage increases which is
seen in the task manager.
please provide me the solution for this ,
this is very urgent..
 
G

Guest

From the way you descibe it you are opening a form. Then opening nested child
dialog forms to 7 deep. Then from the most nested for, re-opening the main
form which then does this all again.
My suggestion to the above is redesign your UI so you dont keep opening so
many popup forms.

HTH

Ciaran O'Donnell
 
C

Chris Dunaway

hi,
i have written a c# program ,in which i have multiple forms.
when i start the application ,the main form opens ,from which iam
calling another form using showdialog(this) method. after that from the
second form iam calling the third form ,again using the same
method,like this iam calling seven forms one after the other, in the
last again i am coming on the main form, this thing is continuous.each
form
now the problem is that each time new form open,memory uasge
increases,this thins thing repeats continuously,due to which when run
the same application two -three times,memory usage increases which is
seen in the task manager.
please provide me the solution for this ,
this is very urgent..

When you open a form using ShowDialog, you must dispose it after you
close the form. It sounds like you are not disposing the form when you
are done. This is not required when you open the form using Show,
only when using ShowDialog.
 

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