* 0xABABABAB : Used by Microsoft's HeapAlloc() to mark "no man's land" guard bytes after allocated heap memory
* 0xABADCAFE : A startup to this value to initialize all free memory to catch errant pointers
* 0xBAADF00D : Used by Microsoft's LocalAlloc(LMEM_FIXED) to mark uninitialised allocated heap memory
* 0xBADCAB1E : Error Code returned to the Microsoft eVC debugger when connection is severed to the debugger
* 0xBEEFCACE : Used by Microsoft .NET as a magic number in resource files
* 0xCCCCCCCC : Used by Microsoft's C++ debugging runtime library to mark uninitialised stack memory
* 0xCDCDCDCD : Used by Microsoft's C++ debugging runtime library to mark uninitialised heap memory
* 0xDEADDEAD : A Microsoft Windows STOP Error code used when the user manually initiates the crash
* 0xFDFDFDFD : Used by Microsoft's C++ debugging heap to mark "no man's land" guard bytes before and after allocated heap memory
* 0xFEEEFEEE : Used by Microsoft's HeapFree() to mark freed heap memory
VC++ 在Debug编译方式编译的程序中,会跟踪用new分配的内存。新分配的内存会用0xcd(助记词为Cleared Data)填充,防止未初始化;当它被delete后,又会被0xdd(Dead Data)填充,防止再次被使用。这样有利于调试内存错误。之所以选这样的填充模式,是因为:
1.大数,若被当成指针就会越界
2.奇数,指针通常指向偶数地址
3.非0,这样不会和 NULL 混淆。
在Release版中不会有这些字节填充。
转自:http://www.cnblogs.com/pcchinadreamfly/archive/2012/04/26/2471317.html
VC的DEBUG版会把未初始化的指针自动初始化为0xCCCCCCCC,而不是就让它随机去,那是因为DEBUG版的目的是为了方便我们调试程序的,如果野指针的初值不确定,那么每次调试同一个程序就可能出现不一样的结果,比如这次程序崩掉,下次正常运行,再一次虽然没崩掉,但结果不对……那显然对我们解bug是非常不利的。
__asm{int 3}的一个用处是在exe中可中断,产生调试。int 3 相当于 DebugBreak, 机器码就是CC。
当一个未初始化赋值的时候(至少是vc 下未初始化的内存)默认是0xCCCCCCCC;,他在内存就默认保存为-858993460 即二进制的11001100 11001100 11001100 11001100; 十六进制的CCCCCCCC;而汉字 "烫" 的编码恰好就是1100110011001100:
转自:http://www.cnblogs.com/qlwy/archive/2012/11/04/2753992.html
0xcdcdcdcd - Created but not initialised
0xdddddddd - Deleted
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/xing901022/p/3360763.html