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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.