I have a Form application. From Form1 I open Form3. On Form3 I have a button that consists of 20 pages of code. (The code reads .txt files store values into vectors)
9/10 Times when pressing this button the program function perfectly but 1/10 times I run the program, an Error message comes up:
Debug Error!
HEAP CORRUPTION DETECTED: before Normal block(#1262858) at 0x268F3148.
CRT detected that the application wrote to memory before start of heap buffer.
I did run the program using the F5 key in VC++ 2008, so I can see on what line this error occur. Every time it points to line 141.
The problem for me is this now:
The code that it refer to is code I haven´t wrote. The call Stack look like this:
(Note! I have taken away a lot of lines from this Call Stack just to simplify it)
(I have take many lines away but it begins with the Optimize_Click on the bottom and then Line 141 comes where the problem occurs)
Form1.exe!operator delete(void* pUserData = 0x2467FB58) Line 56 C++
Form1.exe!std::allocator<int>::deallocate(int* _Ptr = 0x2467FB58, unsigned int __unnamed001 = 200) Line 141 C++
Form1.exe!std::vector<int,std::allocator<int> >::_Tidy() Line 1139 C++
Form1.exe!Form1::Form3::Optimize_Click(System::Object^ sender = 0x014cde68, System::EventArgs^ e = 0x0151aadc) Line 4218 + 0x50 bytes C++
My real question is now, what I see on line 141 above is this:
Form1.exe!std::allocator<int>::deallocate(int* _Ptr = 0x2467FB58, unsigned int __unnamed001 = 200) Line 141 C++
To me this dont tell me anything as this doesn´t refer to acutal code that I have written.
Is it possible to in anyway let C++ find the problem area in the code that I actually have written inside the Optimize_Click.