memory leak in program for windows ce

I have a program that reads in an xml file containing the information for forms (ex. buttons, labels, textboxes). this works all good. But there are about 200 forms that have different controls on them. When you load the first couple of forms the program runs fine and is pretty quick. After about 20 or so forms it starts to slow down. eventually it becomes so slow that it seems to hang up.

all of the controls on the forms are created dynamically and when i clear the form i loop through all of the controls and dispose of them.
I took all of the code out that saves data from these forms. so all i have in there now is the code that loads the controls on to the single form and disposes of the controls.

the problem still exists. anybody have any ideas....please...help.....
rknealAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mikal613Commented:
what language did you write the app in?
0
rknealAuthor Commented:
c#
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Didier VallySystems Engineer and Finance AnalystCommented:
You have to :
- Dynamically create a form when you need to show it
- Dynamically destroy the form when you need to hide it
- Save the data needed for creating the forms in a central class (MVC model)
- Save the data that needs to be shown on forms in this central class
- Access db from this central class
- Generally, all what you programatically do must be done from a main central class...

Example :

1/

Central class named "centralclass.cs" :

public class centralclass(){

public FrmMainForm frmMainForm = null;
public FrmForm2 frmForm2 = null;
public FrmForm3 frmForm3 = null;
(...)

public void centralclass()
{}

}


2/ When you want to show FrmForm2 from FrmMainForm,

You modify the constructor for FrmForm2, making it accept a variable of type "centralclass" :

public class FrmForm2 {

centralclass ccl;

public void FrmForm2(centralclass cclP)
{
this.centralclass = cclP;
}

}


3/ Showing FrmForm2 from FrmMainForm :

if(this.centralclass.frmForm2 == null){
this.centralclass.frmForm2 = new FrmForm2(this.centralclass);
this.env.centralclass.frmForm2.Show();
}
else
{
this.centralclass.frmForm2.Show();
}

}



I hope that helps. This is the only way I see for doing what you want to do.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Smartphone Programming

From novice to tech pro — start learning today.