ValidateFreeSpaces

Syntax

LPSTR ValidateFreeSpaces( )

This function (available only in the debugging version of Windows) checks free segments in memory for valid contents. In the debugging version of Windows, the kernel fills all the bytes in free segments with the hexadecimal value CC. This function begins checking for valid contents in the free segment with the lowest address, and continues checking until it finds an invalid byte or until it has determined that all free space contains valid contents. Before calling this function, put the following lines in the WIN.INI file:

[kernel]

EnableFreeChecking=1

EnableHeapChecking=1

This function has no parameters.

Return Value

None.

Comments

Windows sends debugging information to the debugging terminal if an invalid byte is encountered and performs a fatal exit.

The [kernel] entries in WIN.INI will cause automatic checking of free memory. Before returning a memory block to the application in response to a GlobalAlloc call, Windows checks that memory to make sure it is filled with 0CCH. Before a GlobalCompact call, all free memory is checked. Note that using this function slows Windows down system-wide by about 20%.