memory leak

This is a discussion on memory leak within the C++ Programming forums, part of the General Programming Boards category; helo all after I have created my project with the Builder, it create an executable file, but the problem is ...

  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    37

    memory leak

    helo all
    after I have created my project with the Builder, it create an executable file, but the problem is that: when I open that executable file, it works good , so when I close it, it close normally, but the problem is that when I go to the task manager, I see that the process related for that program is still running, and so it consumes a lot of memory,
    So do u have any suggestion?
    Thanks

  2. #2
    Registered User
    Join Date
    May 2006
    Posts
    903
    Perhaps a little bit of code would help us. My guess is that you didn't properly get out of the message loop or forgot to add PostQuitMessage() in the handling of the WM_DESTROY message.

  3. #3
    Registered User
    Join Date
    Apr 2006
    Posts
    37
    so should I add PostQuitMessage() to my code ??

  4. #4
    Advanced Novice linucksrox's Avatar
    Join Date
    Apr 2004
    Location
    Michigan
    Posts
    198
    My guess is that we're not sure, because we haven't seen your code. So no, adding PostQuitMessage() to your code will not necessarily fix the problem you're having. But maybe...
    "What are all you parallelograms doing here?" - Peter Griffin (to Joe and his wheelchair buddies)

  5. #5
    Registered User
    Join Date
    Apr 2006
    Posts
    37
    well, it is just a simple data base application with interface on the Builder......
    It does have a loop or something about structures and classes

  6. #6
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    Quote Originally Posted by houssam_ballout
    well, it is just a simple data base application with interface on the Builder......
    It does have a loop or something about structures and classes
    Does it dynamically allocate memory? If so, don't forget to delete it before you exit the program. It's very hard for us to help you if you don't put up any code.

  7. #7
    Registered User
    Join Date
    Apr 2006
    Posts
    37
    Well I dont think that it allocates memory dynamically,
    cause I also need to know how to put many fields in the combo box (not using the Items property ....)
    Well this is a simple code from my project, it is the administrator form.

    Code:
    _fastcall TadminForm::TadminForm(TComponent* Owner)
            : TForm(Owner)
    {
    }
    //---------------------------------------------------------------------------
    
    
    void __fastcall TadminForm::StudentInfoButtonClick(TObject *Sender)
    {
    StudentRegistrationForm->Visible = true;
    adminForm->Visible = false;
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TadminForm::CourseInfoButtonClick(TObject *Sender)
    {
    CourseInfoForm->Visible = true;
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TadminForm::Button1Click(TObject *Sender)
    {
    adminForm->Visible = false;
    mainForm->Visible = true;
    
    }
    //---------------------------------------------------------------------------
    
    
    void __fastcall TadminForm::RoomInfoButtonClick(TObject *Sender)
    {
    RoomInfoForm->Visible = true;
    }
    //---------------------------------------------------------------------------
    
    
    void __fastcall TadminForm::Button2Click(TObject *Sender)
    {
    StudentReportForm->Visible = true;
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TadminForm::LogOff1Click(TObject *Sender)
    {
    adminForm->Visible = false;
    mainForm->Visible = true;
            
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TadminForm::Quit1Click(TObject *Sender)
    {
    Close();        
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TadminForm::StudentGridButtonClick(TObject *Sender)
    {
    
    StudentGridForm-> Visible = true;
    adminForm->Visible = false;
    }
    //---------------------------------------------------------------------------
    
    
    void __fastcall TadminForm::StudentSectionButtonClick(TObject *Sender)
    {
    StudentSectionForm->Show();
    }
    //---------------------------------------------------------------------------
    
    void __fastcall TadminForm::Button3Click(TObject *Sender)
    {
    SectionForm->Show();
    }
    //---------------------------------------------------------------------------
    
    
    
    
    
    void __fastcall TadminForm::RegisterButtonClick(TObject *Sender)
    {
    
    }
    //---------------------------------------------------------------------------

  8. #8
    Registered User
    Join Date
    May 2006
    Posts
    903
    Dang, I hate all this Borland crap. It's as worse as MFC. Can't help you on that one, sorry. I'd consider changing IDE if I were you.

  9. #9
    Registered User
    Join Date
    Apr 2006
    Posts
    37
    well what IDE do u advise me to use?

  10. #10
    Registered User
    Join Date
    May 2006
    Posts
    34
    Try Using DevC++ its a GUI for mingw
    Its Really All up to you.

  11. #11
    Registered User
    Join Date
    Apr 2006
    Posts
    37
    well how can I get that?

  12. #12
    Registered User
    Join Date
    May 2006
    Posts
    34
    Its Really All up to you.

  13. #13
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    google is your friend.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory leak in this case?
    By George2 in forum C++ Programming
    Replies: 3
    Last Post: 03-22-2008, 05:05 AM
  2. memory leak in the code?
    By George2 in forum C++ Programming
    Replies: 20
    Last Post: 01-13-2008, 05:50 AM
  3. Is this code memory leak free? ---> POSIX Threads
    By avalanche333 in forum C++ Programming
    Replies: 9
    Last Post: 04-13-2007, 03:19 PM
  4. Any Memory Leak Checking Tool?
    By George2 in forum C Programming
    Replies: 4
    Last Post: 06-21-2006, 11:02 PM
  5. Manipulating the Windows Clipboard
    By Johno in forum Windows Programming
    Replies: 2
    Last Post: 10-01-2002, 09:37 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21