Sunday, July 02, 2006

Imp Values in Debugger

Value Usage
0xCDCDCDCD Allocated in heap, but not initialized
0xDDDDDDDD Released heap memory.
0xFDFDFDFD "NoMansLand" fences automatically placed at boundary of heap memory. Should never be overwritten. If you do overwrite one, you're probably walking off the end of an array.
0xCCCCCCCC Allocated on stack, but not initialized

5 comments:

Anonymous said...

All the latest CRT runtimes come with code which has been compiled with the /GS compiler switch.Also the latest SP6 vc++ service pack also comes with runtimes which has been compiled with that option.
And yes, the vs .net have it turned on by default. Windows Vista has all of it compiled with this option ON. This catches buffer overruns at runtime by comparing the cookie values, before and after.

Anonymous said...

you can also find some information on whether the memory block is allocated or freed by using the heap extention command in windbg.

FarPointer said...

Nice Link which suffices wat Vipin has said :-
http://msdn.microsoft.com/library/?url=/library/en-us/dv_vstechart/html/vctchCompilerSecurityChecksInDepth.asp?frame=true

Anonymous said...

I think these values makes sense only in the debug build.In the release build the values not initialized and when they are released the contents are not cleaned.Thats the reason we initalize it to null everytime we create/delete an object.

FarPointer said...

You mean to say in the release build these values are not there , how can you justify that .