Debugging Dynamic Memory Usage Errors Using HP WDB (5900-1474; WDB 6.2; January 2011)
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.
Debugging Memory Using WDB GUI 79