Access violation writing location 0xfdfdfdfd

£可爱£侵袭症+ 提交于 2020-01-30 13:29:46

问题


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:

  1. You allocate a pointer array and use the "element" behind the last element uninitialized, or (more likely)
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!