Debugging Dynamic Memory Usage Errors Using HP WDB (766161-001, March 2014)
Compilation:
Linking librtc32.sl to a 32bit application:
$ aCC -Ae -I/opt/langtool/wdb/include sample_program.c /opt/langtools/lib/hpux32/librtc.sl -o sample_program
Linking librtc64.sl to a 64bit application:
$ aCC -Ae +DD64 -I/opt/langtool/wdb/include sample_program.c /opt/langtools/lib/hpux64/librtc.sl -o sample_program
Output from the sample_program:
$ ./sample_program
Heap checking using RTC APIs
****All Leaks report**** on Thu Feb 28 00:15:41 2013
150 bytes leaked in 3 blocks
No. Total bytes Blocks Address Function
0 150 3 0x4054ead0 main()
-------------------------------------------------------------------------–
NOTE
Function name "???" implies that user has set min-leak-size; function names are not fetched for leaks of smaller
sizes for better performance.
--------------------------------------------------------------
Detailed Report
-------------------------------------------------------------------------
150 bytes leaked in 3 blocks (100.00% of all bytes leaked)
These range in size from 50 to 50 bytes and are allocated
#0 main() at sample_program.c:19
#1 main_opd_entry() from /usr/lib/hpux32/dld.so
-------------------------------------------------------------------------
****Heap report**** on Thu Feb 28 00:15:41 2013
Actual Heap Usage:
Heap Start = 0x400100f0
Heap End = 0x40553000
Heap Size = 5517072 bytes
Outstanding Allocations:
13508 bytes allocated in 104 blocks
No. Total bytes Blocks Address Function
0 8208 1 0x4054caa0 _findbuf()
1 5000 100 0x4054f510 main()
2 100 1 0x405503f0 main()
3 100 1 0x40550460 main()
4 100 1 0x405504d0 main()
-------------------------------------------------------------------------
Detailed Report
-------------------------------------------------------------------------
8208 bytes at 0x4054caa0 (60.76% of all bytes allocated)
#0 _findbuf() at ../../../../../core/libs/libc/shared_em_32_perf/../core/stdio/flsbuf.c:328
#1 _wrtchk() at ../../../../../core/libs/libc/shared_em_32_perf/../core/stdio/flsbuf.c:262
#2 _printf() at ../../../../../core/libs/libc/shared_em_32_perf/../core/stdio/printf.c:35
#3 main() at sample_program.c:12
-------------------------------------------------------------------------
5000 bytes in 100 blocks (37.02% of all bytes allocated)
These range in size from 50 to 50 bytes and are allocated
#0 main() at sample_program.c:19
#1 main_opd_entry() from /usr/lib/hpux32/dld.so
-------------------------------------------------------------------------
100 bytes at 0x405503f0 (0.74% of all bytes allocated)
#0 main() at sample_program.c:22
#1 main_opd_entry() from /usr/lib/hpux32/dld.so
-------------------------------------------------------------------------
100 bytes at 0x40550460 (0.74% of all bytes allocated)
#0 main() at sample_program.c:23
Additional Examples 91