Debugging Dynamic Memory Usage Errors Using HP WDB
61 /* 4 (3 old and 1 new) interval records;
62 as the repeat count of 100 has been exceeded.
63 */
64 marker1();
65
66
67 /* set repeat count to 500 */
68 for (repeat = 0; repeat < 2; repeat++)
69 for (i = 0; i < 2; i++) {
70 func3();
71 sleep (1);
72 }
73
74 marker1();
75 exit(0);
76 }
Sample Debugging Session
(gdb) file testincremental
Reading symbols from testincremental.. done.
(gdb) set heap-check interval 1
(gdb) set heap-check repeat 2
(gdb) b marker1
Breakpoint 1 at 0x4000000000000e50:0: file testincremental.c,
line 9 from testincremental
(gdb) r
Starting program: testincremental
Breakpoint 1, marker1 () at testincremental.c:9 {}
(gdb) info heap-interval
Analyzing heap ...
==========================================================
Start Time: Mon Oct 30 01:38:11 2006
End Time: Mon Oct 30 01:38:12 2006
Interval: 1
40 bytes allocated in 4 blocks
No. Total bytes Blocks Address Function
0 40 4 0x6000000000004840 func1()
(gdb) c
Continuing.
Breakpoint 1, marker1 () at /testincremental.c:99 {}
(gdb) info heap-interval
Analyzing heap ...
==========================================================
Start Time: Mon Oct 30 01:38:11 2006
End Time: Mon Oct 30 01:38:12 2006
Interval: 1
40 bytes allocated in 4 blocks
No. Total bytes Blocks Address Function
0 40 4 0x6000000000004840 func1()
===========================================================
Start Time: Mon Oct 30 01:38:13 2006
End Time: Mon Oct 30 01:38:14 2006
Interval: 2
40 bytes allocated in 4 blocks
No. Total bytes Blocks Address Function
0 40 4 0x60000000000048c0 func1()
===========================================================
22