问题
I have been having this problem for a few days now and I can find nothing on how to fix it. I have never had an error like this one :
Unhandled exception at 0x00511e0e (msvcr100d.dll) in myproject.exe: 0xC0000005: Access violation writing location 0xfdfdfdfd.
I really am at a loss of what to do. Any help?
回答1:
0xfdfdfdfd
is a magic value in the MSVC debug heap implementation (details here) that's put as a canary directly before and behind an allocated region of storage. Somehow you're using it as a pointer and writing to it.
It's difficult to say with certainty what the error is, since you didn't think it necessary to show any code. I suspect one of two things:
- You allocate a pointer array and use the "element" behind the last element uninitialized, or (more likely)
- You allocate an array of objects (or possibly a vector) whose first data member is a pointer and do the same.
The reason I think the latter more likely is that using pointers in the pointer array uninitialised would break before you got to the end, so you'd have to start at the end, which would be an unusual thing to do.
来源:https://stackoverflow.com/questions/27373322/access-violation-writing-location-0xfdfdfdfd