令人蛋疼的錯誤提示 0xcdcdcdcd ,0xdddddddd ,0xfeeefeee ,0xcccccccc ,0xabababab
阿新 • • 發佈:2018-06-24
ted blog 初始 logs 指針 初始化 man 字節 偶數 0xfeeefeee - Freed memory set by NT‘s heap manager
0xcccccccc - Uninitialized locals in VC6 when you compile w/ /GZ
0xabababab - Memory following a block allocated by LocalAlloc()
原文地址:http://www.cnblogs.com/pcchinadreamfly/archive/2012/04/26/2471317.html
參考地址:http://blog.csdn.net/wuhuiran/article/details/2639800
上面兩者誰轉載了誰(再或者源頭在別處)已經分不清了,都寫上吧!
在寫C++程序的時候,老實0xcdcdcdcd ,0xdddddddd ,0xfeeefeee ,0xcccccccc ,0xabababab這種提示,不知何解,google之,錯誤是這樣產生。
0xcdcdcdcd - Created but not initialised
0xdddddddd - Deleted
0xcccccccc - Uninitialized locals in VC6 when you compile w/ /GZ
0xabababab - Memory following a block allocated by LocalAlloc()
VC++在Debug編譯方式編譯的程序中,會跟蹤用new分配的內存。新分配的內存會用0xcd(助記詞為Cleared Data)填充,防止未初始化;當它被delete後,又會被0xdd(Dead Data)填充,防止再次被使用。這樣有利於調試內存錯誤。之所以選這樣的填充模式,是因為:
1.大數,若被當成指針就會越界
2.奇數,指針通常指向偶數地址
3.非0,這樣不會和 NULL 混淆。
在Release版中不會有這些字節填充。
令人蛋疼的錯誤提示 0xcdcdcdcd ,0xdddddddd ,0xfeeefeee ,0xcccccccc ,0xabababab