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

For more information on the HP aC++ compiler options for memory debugging, see the HP C
World Wide Webpage at:
http://www.hp.com/go/c
Memory Checking Analysis for User Defined Memory Management Routines
Many user applications have their own memory management routines. These custom allocator
routines are either user defined or sometimes wrappers to the default memory management routines.
Memory checking features have been extended for user defined memory management routines.
Memory leak, prole of heap memory, or memory errors can be obtained for user defined memory
management routines.
Following are the limitations for user-defined memory management routines:
This feature routes to default memory routines instead of calling user defined memory
management routines to obtain memory analysis.
This feature is not supported in batch mode and attach mode debugging.
Memory-Debugging Features of WDB
WDB supports the following memory-debugging features:
Heap Profiling features
Leak Profiling feature
Error Injection features
Event Monitoring features
In addition to these features, HP WDB provides the following generic commands for memory
debugging:
Table 3 Generic Commands for Memory Checking
DescriptionCommand
Toggles the setting of commands for detecting leaks,
bounds, double frees, and heap profiling.
set heap-check <on/off>
Displays the current settings for memory checkingshow heap-check
NOTE: GDB reports an incorrect stack trace after dlclose or shl_unload, and a subsequent
dlopen or shl_load. The leaks are displayed erroneously when the memory address range
overlaps between the newly loaded shared library, and the recently unloaded shared library.
Workaround: Place a breakpoint at dlclose or shl_unload, and enter the info leaks
command to view the leaks accurately when a shared library is unloaded.
Heap Profiling
You can profile the heap usage in an application by using WDB. The heap-profiling feature enables
you to analyze the influence of algorithms and data structures on heap usage and tune the memory
requirements of an application.
WDB supports the following heap-analysis profiles:
Snapshot Profile
Incremental Heap Profile
Arena Profile
NOTE: Heap profiling must be enabled to view heap reports. The set heap-check on
command enables heap profiling also.
10