NOTE: Software literature names this concept as premature free or Reading/writing freed memory using a pointer.

WDB tracks the dangling pointers and dangling blocks using a modified version of Garbage collection. The enabler for doing this is by retaining all the freed blocks internally within RTC without actually freeing it as long as possible. It displays all the potential pointers to the freed dangling blocks, in the application data space.

The pointers are potential because the pointers need not be actual pointers and could be a datum value and hence there are chances of false positives in the dangling report.

NOTE: WDB tries to help as much as possible to detect if these pointers are of type datum or real pointers. In a -gcompiled binary, WDB performs a look-up on a symbol table to nd the symbol name and type to nd the symbol name of the potential pointer and if its of pointer type, then the corresponding dangling block is really dangling(not a false positive).

WDB turns on these checks, only when you specify set heap-check retain-freed- blocks on.

14.10.8.6 Detect in-block corruption of freed blocks

HP WDB detects all the attempts of a program to write to the freed dangling blocks using dangling pointers. We detect such in-block corruptions and are reported as part of the existing info corruption command output.

14.10.8.7 Specify the amount of guard bytes for every block of allocated memory

HP WDB enables you to programmatically control the size of guard bytes for every block of the allocated memory. You can use these guard bytes to spot very rare and non-trivial boundary (buffer over-run and buffer under-run) corruptions. This again is available optionally when the user specifies set heap-check retain-freed-blocks <on>.

14.10.9Comparison of Memory Debugging Commands in Interactive Mode and BatchMode

HP WDB 5.6 and later versions provide consistency in format for the batch mode options and the interactive mode commands.

The following table lists the memory debugging commands available in batch and interactive mode:

176 HP-UX Configuration-Specific Information