Debugging Dynamic Memory Usage Errors Using HP WDB (5900-1474; WDB 6.2; January 2011)
NOTE: To attach and find leaks for PA-32 applications from the startup, the environment
variable RTC_INIT must be set to on in addition to preloading the librtc.[sl|so]
library before starting the application, as follows:
$ LD_PRELOAD=/opt/langtools/lib/librtc.sl RTC_INIT=on <executable>
If RTC_INIT is enabled, librtc.[sl|so] starts recording heap information for PA32
process by default. Hence, you must set this environment variable only when it is required.
You must not export the RTC_INIT environment variable for shell.
Summary of Memory Debugging Commands
Most of the commands available in the interactive and the attach modes are also available
in the batch mode. Table 16 (page 75)lists the commands that are available in the batch
mode and the equivalent commands in the interactive mode. It also lists the commands
that are not supported in the batch mode.
Table 16 Commonly Used Commands for Memory Debugging
Batch ModeInteractive Mode/Attach ModeDescription
set heap-check <on/off>set heap-check <on/off>Enables heap profiling
set heap-check leaks
<on/off>
set heap-check leaks
<on/off>
Enables you to detect leaks.
set heap-check free
<on/off>
set heap-check free
<on/off>
Enables you to detect double-frees
and frees with improper
arguments
set heap-check scramble
<on/off>
set heap-check scramble
<on/off>
Enables you to scramble blocks.
set heap-check bounds
<on/off>
set heap-check bounds
<on/off>
Enables you to check for
out-of-bounds corruption when the
block is freed.
set heap-check string
<on/off>
set heap-check string
<on/off>
Enables validation of calls to
strcpy(), strncpy(),
memcpy(),
memccpy(),memset(),
memmove(), bzero(), and,
bcopy()
set heap-check frame-count
<num>
set heap-check
frame-count <num>
Enables you to set the number of
frames to be printed for leak and
heap profiles.
set heap-check
min-heap-size <num>
set heap-check
min-heap-size <num>
Enables you to set the minimum
block size to report in heap
profiles.
Summary of Memory Debugging Commands 75