So, this is very strange, and there can be a very simple explanation for this, but I use a machine that I usually don’t develop with factory -default VS 2010 setup. The code below is exactly what I run and it triggers this familiar message :
Windows called a breakpoint in ProjectB.exe.
This may be due to heap corruption, which indicates an error in ProjectB.exe or any of the loaded DLL files.
This can also be due to pressing the F12 button when ProjectB.exe has focus.
The output window may contain more diagnostic information.
Code:
#include <iostream> #include <cstdlib> using namespace std; int main( int argc, char** argv ) { system( "pause" ); return 0; }
What is it! Nothing more and just one file. Commenting out the system (“pause”) does not cause a break, but I cannot stop the program from exiting (as expected). Therefore, I am very confused. It seems really strange to me, because I have never experienced this before, and I do not understand why this is causing the problem. Using another system command that does not stop the process (for example, system ("cls")) also does not cause a problem. My tendency is that this is characteristic of the machine I'm working on, but I'm not sure. Thanks in advance!
Any help is appreciated.
[EDIT]
So I have never debugged standard headers (at least not purposefully) before, but I noticed one thing:
In __crtCorExitProcess call to load the mscoree.dll module returns a null handle, which means that it is not loaded. I'm not sure what usually happens, but it skips a block of code that gets the proc completion function pointer. It is after calling this method that the ExitProcess call is called, and it is from here that the gap is triggered.
[EDIT 2]
The following is displayed in the output window after calling system( "pause" ) : First chance exception in 0x750cc41f in ProjectB.exe: Microsoft C ++ exception:> log4cxx :: helpers :: IOException in memory location 0x006ff1fc .. First chance exception in 0x750cc41f in ProjectB.exe: Microsoft C ++ exception:> log4cxx :: helpers :: IOException in memory location 0x006ff344 .. Error SPLogger: setFile (C: \ ProgramData \ Safend \ Logs.18698 \ SPHook.log, true). SPLogger: IO Exception: status code = 720005 SPLogger: there is no output stream or file installed for the application named [SPHookLog].
And then, when ExitProcess is called, it is added to the output window:
The thread 'Win32 Thread' (0x1ca8) exited with code 0 (0x0). HEAP [ProjectB.exe]: HEAP: free 21a4ba8 heap block changed at 21a4c10 after freeing
What am I curious about.