I have a strange problem with my code! I have defined several 2D vectors in my function. It is a long function. In debugging mode, I found that there is a problem at the end of the function saying that:
"Exception thrown at 0x770CE43E (ntdll.dll) in hydroprime.exe: 0xC0000005: Access violation reading location 0x40719172."
Then I checked the destructors for the vectors and after counting the number of the destructors, found that the problem is because of a specific destructor.
I used the following command to make sure about that I am counting correctly:
Then I changed the location of the definition of the mentioned 2D vectors a and b and this time I got the error in b instead of a!!
It is something weird for me!
I spent around 5 days in this and could not solve this problem!! Appreciate if you share your thoughts!
if you could pinpoint your error, you would have fixed it already.
so don't go pasting snips that you think are relevant, post a minimal testcase that does reproduce your issue.
It sounds like heap corruption earlier in your program. The problem with heap corruption is that the symptom (like the crash you're seeing) can appear long after the bug (the code that corrupts the heap).
Try running with a memory checker. What you use depends on the compilation environment that you have.