Debugging Dynamic Memory Usage Errors Using HP WDB

Detecting Out-of-Bounds Writes with the Bounds-Checking Feature
The set heap-check bounds <on/off> command toggles the bounds-checking feature in
WDB. When bounds-checking is enabled, WDB allocates extra space (guard bytes) at the beginning
and end of a block during allocation and fills this space with a specific pattern. When the blocks
are freed, the debugger verifies if the patterns are intact. If the patterns are corrupted, the debugger
detects underflow or overflow errors and reports the corruption. Example 12 (page 49) illustrates
the bounds-checking feature.
The bounds checking feature detects overflow and underflow errors only when the write operation
occurs within the guard bytes.
48