Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Message when closing application

Status
Not open for further replies.

Huskey

Vendor
Aug 23, 2002
53
GB
Hi there,

Whenever I closed my program, there is an error message:

#Code

Debug Error!
Program: C:\Program\Testing.exe
Damage: after Client block (#1210) at 0x0032F990
(Please retry to debug the application)

Abort Retry Ignore

#End of Code

Can anyone please explain me what is wrong with my application?

Many thanks!

 
It appears that dynamically allocated memory is not being freed properly. Be sure that your "delete" (C++ operator) or "free" (C function) is releasing the correct block of memory. Be careful! The C functions (malloc, free, et al.) and C++ operators (new, delete) are NOT interchangable.
If your memory block is an array and was allocated with "new", you need to use "delete[]" not "delete."

Be careful that you are not re-assigning a current pointer to a dynamically allocated block of memory to a different place BEFORE saving that current pointer in another pointer or releasing the memory, otherwise you will have memory leaks.

Hope this helps. Happy coding! :)
*~-> EOR Candy <-~*
 
Hi,

Thanks very much for your clear explanation. The problem is encountered after I have installed the newest version of Stlport and linked it with my program. When I compile, everything goes alright. As soon as I close my main application program, the debug error message appears. Is there anyway I could search for the problematic files that has caused the memory leaks? Please help, as my knowledge in C++ is limited.

many thanks!
 
The only thing I can think of is that every time you allocate a block of memory, write down its memory address. Every time you release a block of memory, note the memory address of the pointer to the block of memory BEFORE the release operation (free() or delete) If you find a base address that has changed or have more addresses allocated than released, then you have a memory leak. You will need to use the debugger so you can get the memory address of each block. when you close the application, the debugger should tell you the addresses of the unreleased memory blocks.

Hope this explanation helps! Happy coding. :)
*~-> EOR Candy <-~*
 
Thanks EOR Candy. I deeply appreciate your comments. I will give a try exactly what you have told me.

Have a good day to you.

 
I thought of something else. Be sure that in any one allocated memory block that you do not write more data to it than the size of the allocated block. For example, if you allocate a block of 4096 bytes of memory and then proceed to write 5000 bytes of information to that block, you more than likely will have corrupted memory elsewhere and in that case you will receive the &quot;Damage: after Client&quot; message.

Hope this helps! :)
*~-> EOR Candy <-~*
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top