Debugging Dynamic Memory Usage Errors Using HP WDB v6.3 (5900-2181, August 2012)

the break value. Most implementations of malloc() do not decrease the heap size when the
memory is freed. The break value is indicative of the memory consumption by the program.
Table 10 lists the commands that support the high water mark feature.
Table 10 Commands Supporting High Water-Mark Feature
DescriptionCommand
Displays the number of times that the break value has been
changed for the current run at the instant, the command is
issued
info heap high-mem
Stops when break value has moved the specified number,
<X_number>, of times
set heap-check high-mem-count <X_number>
NOTE: This feature assumes that an application has a deterministic memory allocation pattern
from one run to another.
The info heap high-mem command displays the maximum number of times the break value
changes for a given run. The set heap-check high-mem-count <X_number> stops program
execution when the break value moves a specified number <X_number> of times, and transfers
execution control to the user. Both these commands display the size and call site of the last memory
allocation that extended the high water mark.
This feature also enables you to analyze the memory-usage in an application and check if the
memory-usage is critical or close to triggering an out-of-memory error.Example 10 (page 35)
illustrates the high water mark feature.
34