Why the project causes a breakpoint?

Wrote a project on your computer and during execution of the program gave an error, which you can see in the screenshot. Every once in a new place (then in the destructor, in the setter, but mainly on the function _getch()). It happened that the program is fully all worked on and successfully closed. But it is rare. The fact that no manipulation of the code was not conducted, and just with each new implementation - a new point worked. Re-downloaded Visual Studio - did not help. Thought to show the teacher - at the Academy all worked fine and no breakpoint was not called (though worked on the code and compiled more than 20 times). Then again moved the project onto my computer and again the same error started to haunt me. I have Visual Studio 2015, Windows 10 OS 32bit. At the Academy I use Visual Studio 2013, although there are 15, OS Windows 8.1 64bit. e23ace104b684dfcb93310253f6af5d2.pngeb001a3b780144549c5ae89e9a10fbb9.png
What's the problem?

Do not pay attention to the names of the different projects on screen. Just checking you save create a new solution from this error.
And more: after pressing "quit" and further run the compilation - fails with "Unhandled exception at 0x[address] (ntdll.dll) in AcademyGroup v1.1.exe 0x[address]: the Heap has been corrupted (parameters: 0x[address])."
3ca63607e5124e1ea2eebf77a5b31e9f.png66a330fa56694740b1ffd9d49557d55c.png
July 4th 19 at 23:58
1 answer
July 5th 19 at 00:00
It is obvious that the heap is corrupted. Most likely due to careless use dynamic memory (for example, caused by double-free for one pointer)
free is delete? - Horace.Legros75 commented on July 5th 19 at 00:03
In fact - Yes. Called inside delete free. - estelle.Collins42 commented on July 5th 19 at 00:06
but why each time in a new place and most of the function _getch()? - Horace.Legros75 commented on July 5th 19 at 00:09
because the heap corruption is detected when the next memory allocation from it. - estelle.Collins42 commented on July 5th 19 at 00:12
: replaced all strcpy to strcpy_s and everything works fine. I'm in shock. - Horace.Legros75 commented on July 5th 19 at 00:15
So, most likely, the heap corruption was caused by going beyond the allocated memory. - estelle.Collins42 commented on July 5th 19 at 00:18

Find more questions by tags C++