memory leak in program for windows ce

Posted on 2006-03-23
Last Modified: 2013-12-27
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
Question by:rkneal
    LVL 48

    Expert Comment

    what language did you write the app in?

    Author Comment

    LVL 48

    Accepted Solution

    LVL 5

    Assisted Solution

    by:Didier Vally
    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 :


    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);


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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
    You should read OS supplied guidelines before developing. I can't stress that enough. The guidelines will help you understand the reasons mobile app developers do what they do.  Apple is very particular when they review appstore submissions.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now