Debugging Dynamic Memory Usage Errors Using HP WDB

FAQ
1 Does WDB report all the leaks in a program?
WDB uses a conservative leak detection algorithm. As a result, all leaks may not be reported,
but all reported leaks are definite leaks. WDB reports leaks only in the code path exercised in
the current run.
2
I wrote a small sample program that allocates a block using malloc() and leaks the block
immediately, by assigning NULL to the pointer, but WDB does not report this block as a leak.
Why?
This is attributed to the leak detection algorithm followed by WDB. If the datum in the program
address space masks a leak, the leak is not reported. In this case the address returned from
malloc() is stored in the architecture registers and consequently masks the leak. Typically,
if you call any function after the leak, such as a printf(), then WDB can catch the leak.
3 Does WDB support detection of leaks in a third party code?
Yes. WDB supports detection of leaks in a third party code also.
4 What are the commands that the batch mode of memory-debugging does not support?
For more information on the commands that are supported in batch mode, see “Summary of
Memory Debugging Commands (page 64)
5 Can WDB debug applications with user-defined memory management routines?
WDB can debug applications with memory management routines that are either user defined
or are wrappers to the default memory management routines.
NOTE:
This feature is not supported in the batch and the attach modes of debugging.
In interactive mode, this feature will result in calls to the user defined memory
management routines being re-routed to default memory management routines.
6 Which version of WDB supports debugging of applications with custom allocators?
WDB 5.5 and above versions support the debugging of applications with custom allocators.
7 Does WDB report the exact instant when the block becomes a leak?
No. WDB does not provide information on when the leak occurred. It reports only the allocation
stack trace of the leaked block and does not report the stack trace where the block leaked.
8
Does WDB support debugging of C++ applications with calls to new() and delete()?
Yes. WDB supports debugging of C++ applications with new() and delete() calls only if
they internally call malloc() and free().
9 Does WDB support memory-debugging of long running applications?
Yes. WDB supports debugging of long running applications such as daemons. However, the
daemons must be started with an explicit LD_PRELOAD of the correct version (32-bit or 64-bit)
of librtc.[sl|so], so that WDB can debug memory when it later attaches to the daemon
process."
Index
A
Access Errors, 15
Attach Mode, 63
B
Batch Mode , 56
Batch Mode Configuration File, 57
BATCH_RTC, 56
FAQ 73