I have been trying to trouble shoot this error now for a while and I am at a standstill right now. The code I've written seems to run start to finish but when the program is closing it crashes instead of exiting properly. I am thinking this is a problem with memory allocation but am slight unsure where to start looking for these bugs. I don't declare anything with new, I also am only using vectors which deallocate memory once the program closes. So I was wondering if anyone has advice for an error of this sort and any idea on where to start looking to fix it. I can provide code if need but its long and kinda messy at this point.
What platform are you running on? There are some heap checking tools around like Valgrind; Microsoft C/C++ has heap debugging you can switch on. I think we're all agreed you've corrupted the heap in some way.