The Uninitialized Data tab provides controls for determining how uninitialized data detection hooks are installed.
The default settings are shown below:
By default, uninitialized data checking is switched off, but you can turn it on and control how it works
•Enable detection of uninitialized data detects uninitialized data in C++ objects in your application
Once enabled the additional options are
•Uninit check once only check each object type once (the default), rather than every time their constructors are called
•Uninit count until uninit check an object type for uninitialized data only until uninitialized data is detected
The recommended option is to disable this and always check for uninitialized data irrespective of when an instance is found.
•Detect for uninitialized HeapAlloc() enables detection of uninitialized data in C++ objects which have overridden the new operator and instead allocate from a heap using HeapAlloc()
Your overridden new operator will need to initialise any allocated memory with the DWORD value 0xbaadf00d for uninitialized data to be detected.
When Memory Validator is looking for uninitialized memory, it searches for bit patterns in memory that match the default value assigned by the debug Microsoft® C runtime heap:
•0xCD for BYTEs
•0xCDCD for WORDs
•0xCDCDCDCD for DWORDs and 32 bit pointers
•0xCDCDCDCDCDCDCDCD for QWORDs and 64 bit pointers
It may not be that uncommon to find a byte that has actually been initialised to 0xCD - a 1 in 256 chance for random data for example.
It's less likely to find words similarly initialised to 0xCDCD and really very unlikely to find such DWORDS (1 in 4 billion for random data) and QWORDS (1 in 16 quintillion).
If you are finding false positives however, where an initialised value is the same as the uninitialized default, you can choose which data size Memory Validator uses to detect uninitialized memory:
•Data size when checking for unitialised memory choose a data size to match against from the list - BYTE, WORD, 32 bit pointer or 64 bit pointer
The default is 32 bit pointer (same size as a DWORD) which normally minimizes the chance of random false positives.
If you want to detect uninitialised pointers on 64 bit machines choose the 64 bit pointer option. Option only available on 64 bit machines.
Choose to use data member names or member offsets.
By default, the reporting of uninitialised data uses data member names which are cached between sessions, being recalculating only when the module containing the class is rebuilt.
However, it's not always possible to determine data member names, so on these occasions data member offsets are displayed.
You can choose to always display the offsets rather than the names:
•Use data member names... unchecked: displays offsets all the time and doesn't use member names at all
When use of data member names is enabled, you can control the caching:
Cache data member information unchecked: recalculates data member names every session, rather than the default of caching data on disk
Delete all cached data removes all cached data member information from disk
Reset All - Resets all global settings, not just those on the current page.
Reset - Resets the settings on the current page.