On Wed, Apr 15, 2009 at 10:25 AM, Igor R
Bad if the vector resizes and moves them elsewhere
std::vector guarantees that its elements are stored in a contiguous memory block, so it definitely moves the data on resize and invalidates iterators.
I changed from /MT to /MD compiles as per Neil's suggestion and the crash moved to a slightly later new call.
This strengthens the assumption that you've got a heap corruption.
Hmm, wow, ok I think you were right, but it was really subtle. :( //String is read in from file, delimited. char string[32]; File.getline(string, 32, '"'); int Length = strlen(string); // <-- Does not include Null character! char* Name = new char[Length]; // <-- One char too small strcpy(Name, string); // <-- Corrupted 1 byte after Name's end. And I guess the reason it didn't crash when an external app was hooking / starting my program was because it just randomly shifted the heap? Fixing the above(and using strcpy_s) fixed the crash in my smaller subset of the program, but it still crashes later. Probably because of how I was mis-using vectors. Thanks for the help everyone. My stupidity. Weird that it only happened when run standalone though. Jared