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

Stops if the following block address is allocated or de-allocated
Stops program execution when an allocation causes heap growth exceeding <num> bytes
Collects memory leak data (equivalent to info leak) and memory-usage (equivalent to info
heap) data
WDB GUI supports both interactive and attach mode of memory-debugging. It does not support
the batch mode debugging of applications.
The source window in the WDB GUI displays the source code. The command window displays
the output after debugging the application. It also enables you to use the command-line interface
in WDB. The command window can be used to take advantage of memory-debugging features
that are not directly supported in the GUI.
Using WDB GUI to Debug Memory-Related Problems
To debug an application for memory problems using WDB GUI, complete the following steps:
1. Load the program to WDB as follows:
Select File —> Load Program in the WDB GUI window.
In the Load Program dialog-box, enter the executable name to load the executable or use
the PID to attach a process for debugging.
2. After you load the application, you can set the memory checking preferences by setting the
preferences in the Memory Checking window. Select Tools —>Memory Checking to activate
the Memory Checking window.
3. To set a break-point using WDB GUI, click the rectangular selection strip adjacent to the
specific program line-number in the source window. When the breakpoint is set, a red
octagonal button appears at the specified probe-point. Alternatively, you can set breakpoints
by selecting Edit —>Breakpoints and specifying the breakpoints in the Breakpoints window.
4. Run the application. WDB GUI now gives you the leaks usage, memory-usage and the results
of memory checking at the specified break-points.
Heap and Leak Profiling Using WDB GUI
In order to view the heap report and leak reports while debugging the application, select the
Memory Usage tab in the command window. On selecting the Memory Usage tab, the Memory
Leaks and Memory Usage options are displayed.
To view the leak report, select the Memory Leaks option. The stack-unwind information for each
leak can be obtained by expanding the enhanced array browser for each leak.
To see a heap report, select the Memory Usage option. The stack-unwind information can be
obtained by expanding the enhanced array browser for each block of the heap.
Incremental Heap Profiling Using WDB GUI
HP WDB GUI provides support to view the incremental heap profile for a program.
To view the incremental heap profile for a program, complete the following steps:
1. Load the program to WDB GUI.
2. Select Tools->Memory Check
3. Select the Incremental Heap Check Settings option while setting the memory debugging
preferences in the Memory Check window.
4. Enter Heap Check Interval and Heap Check Repeat Count in the Memory Check window.
5. Run the program after setting the required breakpoints.
62