Possible Duplicate:
When and why will an OS initialise memory to 0xCD, 0xDD, etc. on malloc/free/new/delete?
Why is memory I haven't initialized set to 0xCC
?
Setting the memory to 0xCC
will decrease performance, so there must be a reason for filling the memory with this byte.
The compiler does this for you in debug mode, so that if you accidentally read uninitialized memory, you'll see the distinctive 0xCC value, and recognize that you (probably) read uninitialized memory. The 0xCC value has a lot of other useful properties, for example it is the machine language instruction for invoking a software breakpoint should you accidentally execute some uninitialized memory.
The basic principle: make it easy to identify values that come from reading uninitialized memory.
This doesn't happen in your release builds.
This technique was introduced in Writing Solid Code.
0xCC is machine code instruction to invoke break point. For more information see another question.
Inside CRT: Debug Heap Management
Magic Number on Wiki:
In Visual Studio CRT Source,
\VC\crt\src\malloc.h
: