943,788 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 417
  • C++ RSS
Jan 7th, 2009
0

Builder cpp 6 - resources problem

Expand 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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
35nando is offline Offline
10 posts
since Dec 2008
Jan 7th, 2009
0

Re: Builder cpp 6 - resources problem

Click to Expand / Collapse  Quote originally posted by 35nando ...
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
Reputation Points: 590
Solved Threads: 123
Practically a Master Poster
JasonHippy is offline Offline
672 posts
since Jan 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Memory Access Violation
Next Thread in C++ Forum Timeline: Testing whether function is interruptable or not





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC