Link to home
Start Free TrialLog in
Avatar of Wanting2LearnMan
Wanting2LearnManFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Program get slower and slower then gradually freezes.

I am trying to fix a problem where my Windows Mobile application freezes.  My Application just inserts data in to a database (codebase).  The user just presses a button and a series of other dialogs come up and ask questions etc then the info is inserted into a database.

I have tested it flat out for about 5 hours now and I notice that the dialogs gradually get slower and slower to launch.  Just a few moments ago it froze while one dialog was trying to launch (when it froze the pda screen was like a morph of the new dialog ontop of the main dialog).

I am just looking for general help as to possibly why windows MFC dialogs would get slower and slower to launch and then freeze.  I have been looking for memory leaks etc and have found nothing major that I can see to be the problem.

My application is written using MFC (it was an eVC4 application converted to VS2005 now).

How could I best solve this problem?  any tools that VS provides that could help me etc.
SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Wanting2LearnMan

ASKER

>>When you run in DEBUG mode do you get a message about memory leaks when you close the app?
Do you mean  build the debug version and run the exe on my device for a short while then close it.  
What kind of a message do you mean?  A pop up message box??

Thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK I'll try that.
I am also going to test my app again only without launching certain dialogs, that way I will try to narrow it down to which dialogs might be causing the problem.
Is this a good way to go??
My problem is that it took 4.5 hours of use for it to freeze so its a bit of a nightmare....

Can you think of any other ways to track down resource leaks??
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The users of my progam only ever use it for about one hour at a time.  And since it crashes after about 4 hours use, if I tell them to exit my program after they use it, will that will that mean that any leaks will be cleared?

This may buy me some time until I gat if fixed...

Let me know your thoughts sure.

Thanks
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for all the comments.

I have built my program in debug mode and started to run it in the emulator.  
The first dialog screen shows up fine but when I press a button to launch the next 'main menu' screen I get an error at line 1. below:  (Please see the attached file for the error).  

void CBegin::OnOkButton()
{
       1. CMainMenu dlgMainMenu;
       2. dlgMainMenu.DoModal();
}

Perhaps this is nothing or it could be an indication of a problem.

I appreciate any help you can give me.
Error.jpg
>>All that needs is for the app to be run in DEBUG mode from the IDE and look at the output pane.

I cant run it in the output pane due to the above error.   :o(  ANy ideas?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I ran my program in debug and stepped through it and noticed some things which were showing to be a problem in debug mode.
For example:

In my OnPaint I was Loading a bitmap like so:
CBitmap bmp;
bmp.LoadBitmap(IDB_ARROWUP_BITMAP);      

and I forgot to do
bmp.DeleteObject(); afterwards.  This caused the debugger to crash.

Also I had some strange behaviour when I tried to launch dialogs where the program would also crash in debug mode so I increased the stack reserve also from the default 64k to 128K.  Hopefully this will not just 'delay' the problem.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>Why not have a member var of the class as the bitmap and load just once in the OnInitDialog ?
Ok I will do that :)