Link to home
Start Free TrialLog in
Avatar of Peter Chan
Peter ChanFlag for Hong Kong

asked on

C++ Problem to run - Heap Corruption Detected

Hi,
I get
User generated image
when running the project. What to check?
Avatar of Karrtik Iyer
Karrtik Iyer
Flag of India image

1> if you have a the source code of DB Server.exe, you can press retry and attach a debugger (visual studio) so that it opens up in visual studio, this might give you some hints on where exactly in your code this corruption is happening. if DBServer.exe is built in debug mode it would be helpful.
2> Or if you have logs of your system/application (DBServer), it might help you look at your logs to see and find out some workflow or isolate some part of your code from logs which could point to the code where corruption might have happened.
3> Or run DBServer.exe in debug mode and enable break on exceptions setting in visual studio, and let it run so that the code stops when an exception happens.
ASKER CERTIFIED SOLUTION
Avatar of sarabande
sarabande
Flag of Luxembourg 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
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
Avatar of Peter Chan

ASKER

Thanks to all.
How to test and run the whole process for detecting the real reason?
Avatar of phoffric
phoffric

Heap corruption is often difficult to isolate.

One approach is to whittle away the most recent added code to revert back to where the problem did not occur. Once there, then add code back in a bit at a time and repeat (i.e., do it like a binary search).

Usually, looking for pointer operations is also a good place to start.

A free trial of Parasoft's Insure++ should identify the problem quickly.
https://www.parasoft.com/product/insure/
Thanks Phoffric.

those errors often happen if the index of an array was calculated wrongly and so an array accidently was accessed outside of the allocated memory. the developer has a good chance to find out where it goes wrong though it might not be so simple to correct the error if the program has some kind of complexity.

Sara,
Any other advice to check, if I cannot identify the reason, within the codes?
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
Many thanks Subrat.
How to start the exe in windbg and get the core dump?
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Split:
-- sarabande (https:#a41600773)
-- phoffric (https:#a41601768)
-- Subrat (C++ windows/Linux) (https:#a41618470)


If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

frankhelk
Experts-Exchange Cleanup Volunteer