Builder cpp 6 - resources problem

Reply

Join Date: Dec 2008
Posts: 10
Reputation: 35nando is an unknown quantity at this point 
Solved Threads: 0
35nando 35nando is offline Offline
Newbie Poster

Builder cpp 6 - resources problem

 
0
  #1
Jan 7th, 2009
I made an application in Builder C++ 6.
It contains few graphic elements, few image lists. I use drawing on Canvas.
After short using my application, following message appears: "out of system resources". After it, my application behaves strangly and freezes. I use onPaint event.
My exe weights 2200 KB
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 289
Reputation: JasonHippy is a jewel in the rough JasonHippy is a jewel in the rough JasonHippy is a jewel in the rough JasonHippy is a jewel in the rough 
Solved Threads: 48
JasonHippy's Avatar
JasonHippy JasonHippy is offline Offline
Posting Whiz in Training

Re: Builder cpp 6 - resources problem

 
0
  #2
Jan 7th, 2009
Originally Posted by 35nando View Post
I made an application in Builder C++ 6.
It contains few graphic elements, few image lists. I use drawing on Canvas.
After short using my application, following message appears: "out of system resources". After it, my application behaves strangly and freezes. I use onPaint event.
My exe weights 2200 KB
From what you've said so far it sounds like the classic symptoms of a memory leak to me. The error message says it all!

The causes of memory leaks are not always glaringly obvious, but put in some breakpoints and step through your program and try to debug what is going on.
I'm sure you'll track it down eventually.

It's likely to be in a function that gets called often.
It could very well be something in your OnPaint() code.

The size of the final executable has no bearing on it's memory usage. Basically, what is happening is your program is allocating memory and never freeing/deleting it. Eventually your pc runs out of memory and your program is crashing.

There is no automatic garbage collection in C/C++, so any memory resources you allocate in your program must be freed.
You must ensure that 'delete' is called on any objects created using the 'new' keyword before they drop out of scope. Similarly any memory that has been allocated using alloc() or malloc() must be freed by a call to free().

Sometimes memory leaks can be the trickiest things in the world to pin down, other times they are so obvious you just want to kick yourself!

As long as you have a good debugging technique, you should be able find the cause of the problem.

I hope this is of some help!

Cheers for now,
Jason
There are 10 types of people in this world.....
Those who understand binary .....
And those who don't!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC