Hi,
Sometimes in execution I get this error message in VS2010 when trying to free memory:
Windows has triggered a breakpoint in [APPNAME].exe.
This may be due to a corruption of the heap, which indicates a bug in [APPNAME].exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while [APPNAME].exe has focus.
The output window may have more diagnostic information.
Wich means something is wrong with heap or pointer.
My issue is that this error crashes my app when it is built as a release.
Also this is just a module of bigger application and when this crashes everithing goes down.
I would like to be able to handle this error.
From msdn on "free":
If an error occurs in freeing the memory, errno is set with information from the operating system on the nature of the failure. For more information, see errno, _doserrno, _sys_errlist, and _sys_nerr.
There is a errno_t _get_errno( int * pValue );
function that returns error code.
If I press continue on the error msg shown above this function returns error code. Using this code I can detect error, create call stack and exit my function softly.
Is there any compiler switch or something to prevent aplication from crashing when free fails and allow me to exit it my way??