dbmalloc Tutorial: Example Instructions
First, collect all the files for the example.
Perform the following:
- pmake all
- pmake runtests
- more Runtests.out
What follows is the contents of Runtests.out. Review it so that you can
understand what kind of reporting dbmalloc makes available.
This file contains the outputs from the tests run by the Runtests script.
For more info on a particular test, check the README file
************ Running testmem test...
PASSED testmem test
************ Running stack test
PASSED teststack test
MALLOC Warning from malloc() (called from teststack.c line 63):
Allocation of zero length segment
MALLOC Warning from malloc() (called from teststack.c line 82):
Allocation of zero length segment
MALLOC Warning from strcpy() (called from teststack.c line 99):
Pointer within malloc region, but outside of malloc data bounds
This error is *probably* associated with the following allocation:
A call to malloc for 1 bytes in teststack.c on line 97.
This was the 5th call to malloc.
Stack from where allocated:
-> sub3() in teststack.c(95)
-> sub2() in teststack.c(80)
-> sub1() in teststack.c(61)
-> main() in teststack.c(42)
MALLOC Warning from strcpy() (called from teststack.c line 99):
Pointer within malloc region, but outside of malloc data bounds
This error is *probably* associated with the following allocation:
A call to malloc for 1 bytes in teststack.c on line 97.
This was the 7th call to malloc.
Stack from where allocated:
-> sub3() in teststack.c(95)
-> sub1() in teststack.c(61)
-> main() in teststack.c(42)
MALLOC Warning from malloc() (called from teststack.c line 82):
Allocation of zero length segment
MALLOC Warning from strcpy() (called from teststack.c line 99):
Pointer within malloc region, but outside of malloc data bounds
This error is *probably* associated with the following allocation:
A call to malloc for 1 bytes in teststack.c on line 97.
This was the 9th call to malloc.
Stack from where allocated:
-> sub3() in teststack.c(95)
-> sub2() in teststack.c(80)
-> sub1() in teststack.c(61)
-> main() in teststack.c(42)
MALLOC Warning from malloc() (called from teststack.c line 82):
Allocation of zero length segment
MALLOC Warning from strcpy() (called from teststack.c line 99):
Pointer within malloc region, but outside of malloc data bounds
This error is *probably* associated with the following allocation:
A call to malloc for 1 bytes in teststack.c on line 97.
This was the 13th call to malloc.
Stack from where allocated:
-> sub3() in teststack.c(95)
-> sub2() in teststack.c(80)
-> main() in teststack.c(42)
MALLOC Warning from strcpy() (called from teststack.c line 99):
Pointer within malloc region, but outside of malloc data bounds
This error is *probably* associated with the following allocation:
A call to malloc for 1 bytes in teststack.c on line 97.
This was the 15th call to malloc.
Stack from where allocated:
-> sub3() in teststack.c(95)
-> main() in teststack.c(42)
************************** Dump of Malloc Chain ****************************
POINTER FILE WHERE LINE ALLOC DATA HEX DUMP
TO DATA ALLOCATED NUMBER FUNCT LENGTH OF BYTES 1-7
-------- -------------------- ------- -------------- ------- --------------
08023580 teststack.c 44 malloc(2) 10 01010101010101
-> main() in teststack.c(42)
080235D8 teststack.c 63 malloc(3) 0
-> sub1() in teststack.c(61)
-> main() in teststack.c(42)
08023628 teststack.c 82 malloc(4) 0
-> sub2() in teststack.c(80)
-> sub1() in teststack.c(61)
-> main() in teststack.c(42)
08023678 teststack.c 97 malloc(5) 1 31
-> sub3() in teststack.c(95)
-> sub2() in teststack.c(80)
-> sub1() in teststack.c(61)
-> main() in teststack.c(42)
080236C8 teststack.c 86 malloc(6) 10 01010101010101
-> sub2() in teststack.c(80)
-> sub1() in teststack.c(61)
-> main() in teststack.c(42)
08023720 teststack.c 97 malloc(7) 1 31
-> sub3() in teststack.c(95)
-> sub1() in teststack.c(61)
-> main() in teststack.c(42)
08023770 teststack.c 82 malloc(8) 0
-> sub2() in teststack.c(80)
-> sub1() in teststack.c(61)
-> main() in teststack.c(42)
080237C0 teststack.c 97 malloc(9) 1 31
-> sub3() in teststack.c(95)
-> sub2() in teststack.c(80)
-> sub1() in teststack.c(61)
-> main() in teststack.c(42)
08023810 teststack.c 86 malloc(10) 10 01010101010101
-> sub2() in teststack.c(80)
-> sub1() in teststack.c(61)
-> main() in teststack.c(42)
08023868 teststack.c 71 malloc(11) 10 01010101010101
-> sub1() in teststack.c(61)
-> main() in teststack.c(42)
080238C0 teststack.c 82 malloc(12) 0
-> sub2() in teststack.c(80)
-> main() in teststack.c(42)
08023910 teststack.c 97 malloc(13) 1 31
-> sub3() in teststack.c(95)
-> sub2() in teststack.c(80)
-> main() in teststack.c(42)
08023960 teststack.c 86 malloc(14) 10 01010101010101
-> sub2() in teststack.c(80)
-> main() in teststack.c(42)
080239B8 teststack.c 97 malloc(15) 1 31
-> sub3() in teststack.c(95)
-> main() in teststack.c(42)
************ Running malloc test
PASSED malloc test
MAXITER 5000 MAXOBJS 1000 BIGOBJ 90000, TINYOBJ 80, nbig/ntiny 1/100
Memory use at start: 8192 bytes
Starting the test...
0 iterations
Did 5000 iterations, 994 objects, 3081 mallocs, 1919 reallocs
Memory use at end: 786432 bytes
Memory use after free: 786432 bytes
startsize 8192 != endsize 786432
**************************************************************** Dump of Malloc Chain *****************************************************************
FREE FREE ACTUAL SIZE POINTER FILE WHERE LINE ALLOC DATA HEX DUMP
PTR NEXT PREV NEXT PREV FLAGS INT HEX TO DATA ALLOCATED NUMBER FUNCT LENGTH OF BYTES 1-7
-------- -------- -------- -------- -------- ---------- -------- --------- -------- -------------------- ------- -------------- ------- --------------
0801F4D0 08023958 0x000000 0x000000 0x000000 0x00000000 0(0x000000 )0801F518 unknown Unknown(0) 0
08023958 0x000000 0801F4D0 0x000000 0x000000 0x3156113A 786360(0x0BFFB8 )080239A0 testmalloc.c 111 calloc(1) 786360 02020202020202
Malloc start: 0x0801F4D0
Malloc end: 0x08023958
Malloc data start: 0x08023958
Malloc data end: 0x080E3958
Malloc free list: 0x08023958
************ Running error test
PASSED error test
-------------------------------------
Testing malloc_inuse()...OK
-------------------------------------
Testing malloc_mark()...OK
-------------------------------------
Testing malloc_size()...OK
-------------------------------------
Testing memalign()...OK
-------------------------------------
Error from strcpy() - out of bounds
MALLOC Warning from strncpy() (called from testerr.c line 134):
Pointer within malloc region, but outside of malloc data bounds
This error is *probably* associated with the following allocation:
A call to malloc for 10 bytes in testerr.c on line 129.
This was the 3rd call to malloc.
-------------------------------------
Error from memset() - out of bounds (beyond)
MALLOC Warning from memset() (called from testerr.c line 139):
Pointer within malloc region, but outside of malloc data bounds
This error is *probably* associated with the following allocation:
A call to malloc for 20 bytes in testerr.c on line 127.
This was the 2nd call to malloc.
-------------------------------------
Error from free() - overrun
MALLOC Warning from free() (called from testerr.c line 144):
Data has overrun beyond requested number of bytes
This error is *probably* associated with the following allocation:
A call to malloc for 20 bytes in testerr.c on line 127.
This was the 2nd call to malloc.
MALLOC Warning from free() (called from testerr.c line 144):
Data has overrun beyond requested number of bytes
This error is *probably* associated with the following allocation:
A call to malloc for 10 bytes in testerr.c on line 129.
This was the 3rd call to malloc.
-------------------------------------
Error from free() - double free
MALLOC Warning from free() (called from testerr.c line 149):
Data area is not in use (can't be freed or realloced, or used)
This error is *probably* associated with the following allocation:
A call to malloc for 20 bytes in testerr.c on line 127.
This was the 2nd call to malloc.
This block was freed on the 1st call to free()
in testerr.c on line 144.
-------------------------------------
NO error from bzero
-------------------------------------
Error from bzero() - out of bounds
MALLOC Warning from bzero() (called from testerr.c line 159):
Pointer within malloc region, but outside of malloc data bounds
This error is *probably* associated with the following allocation:
A call to malloc for 10 bytes in testerr.c on line 129.
This was the 3rd call to malloc.
-------------------------------------
Error from free() - overrun
MALLOC Warning from free() (called from testerr.c line 164):
Data has overrun beyond requested number of bytes
This error is *probably* associated with the following allocation:
A call to malloc for 10 bytes in testerr.c on line 129.
This was the 3rd call to malloc.
-------------------------------------
Error from memset() - out of bounds (before)
MALLOC Warning from memset() (called from testerr.c line 171):
Pointer within malloc region, but outside of malloc data bounds
This error is *probably* associated with the following allocation:
A call to malloc for 1 bytes in testerr.c on line 166.
This was the 4th call to malloc.
-------------------------------------
Error from free() - underrun
MALLOC Warning from free() (called from testerr.c line 176):
Data has written before beginning of requested bytes
This error is *probably* associated with the following allocation:
A call to malloc for 1 bytes in testerr.c on line 166.
This was the 4th call to malloc.
-------------------------------------
Error from memset() - out of bounds
MALLOC Warning from memset() (called from testerr.c line 184):
Pointer within malloc region, but outside of malloc data bounds
This error is *probably* associated with the following allocation:
A call to malloc for 10 bytes in testerr.c on line 178.
This was the 5th call to malloc.
-------------------------------------
Error from malloc() - chain broken
MALLOC Warning from malloc() (called from testerr.c line 190):
Pointers between this segment and adjoining segments are invalid
This error is *probably* associated with the following allocation:
A call to malloc for 10 bytes in testerr.c on line 178.
This was the 5th call to malloc.
MALLOC Warning from malloc() (called from testerr.c line 190):
Malloc region does not have valid magic number in header
MALLOC Fatal error from malloc() (called from testerr.c line 190):
Pointer is not within malloc area
sh: 3611 Abort
************ Running C++ error test
PASSED C++ error test
-------------------------------------
Testing malloc_inuse()...OK
-------------------------------------
Testing malloc_mark()...OK
-------------------------------------
Testing malloc_size()...OK
-------------------------------------
Testing memalign()...OK
-------------------------------------
Error from strcpy() - out of bounds
MALLOC Warning from strncpy() (called from testerr++.C line 134):
Pointer within malloc region, but outside of malloc data bounds
This error is *probably* associated with the following allocation:
A call to new for 10 bytes in testerr++.C on line 129.
This was the 3rd call to new.
-------------------------------------
Error from memset() - out of bounds (beyond)
MALLOC Warning from memset() (called from testerr++.C line 139):
Pointer within malloc region, but outside of malloc data bounds
This error is *probably* associated with the following allocation:
A call to new for 20 bytes in testerr++.C on line 127.
This was the 2nd call to new.
-------------------------------------
Error from free() - overrun
MALLOC Warning from delete() (called from testerr++.C line 144):
Data has overrun beyond requested number of bytes
This error is *probably* associated with the following allocation:
A call to new for 20 bytes in testerr++.C on line 127.
This was the 2nd call to new.
MALLOC Warning from delete() (called from testerr++.C line 144):
Data has overrun beyond requested number of bytes
This error is *probably* associated with the following allocation:
A call to new for 10 bytes in testerr++.C on line 129.
This was the 3rd call to new.
-------------------------------------
Error from free() - double free
MALLOC Warning from delete() (called from testerr++.C line 149):
Data area is not in use (can't be freed or realloced, or used)
This error is *probably* associated with the following allocation:
A call to new for 20 bytes in testerr++.C on line 127.
This was the 2nd call to new.
This block was freed on the 1st call to delete()
in testerr++.C on line 144.
-------------------------------------
NO error from bzero
-------------------------------------
Error from bzero() - out of bounds
MALLOC Warning from bzero() (called from testerr++.C line 159):
Pointer within malloc region, but outside of malloc data bounds
This error is *probably* associated with the following allocation:
A call to new for 10 bytes in testerr++.C on line 129.
This was the 3rd call to new.
-------------------------------------
Error from free() - overrun
MALLOC Warning from delete() (called from testerr++.C line 164):
Data has overrun beyond requested number of bytes
This error is *probably* associated with the following allocation:
A call to new for 10 bytes in testerr++.C on line 129.
This was the 3rd call to new.
-------------------------------------
Error from memset() - out of bounds (before)
MALLOC Warning from memset() (called from testerr++.C line 171):
Pointer within malloc region, but outside of malloc data bounds
This error is *probably* associated with the following allocation:
A call to new for 1 bytes in testerr++.C on line 166.
This was the 4th call to new.
-------------------------------------
Error from free() - underrun
MALLOC Warning from delete() (called from testerr++.C line 176):
Data has written before beginning of requested bytes
This error is *probably* associated with the following allocation:
A call to new for 1 bytes in testerr++.C on line 166.
This was the 4th call to new.
-------------------------------------
Error from memset() - out of bounds
MALLOC Warning from memset() (called from testerr++.C line 184):
Pointer within malloc region, but outside of malloc data bounds
This error is *probably* associated with the following allocation:
A call to new for 10 bytes in testerr++.C on line 178.
This was the 5th call to new.
-------------------------------------
Error from malloc() - chain broken
MALLOC Warning from new() (called from testerr++.C line 190):
Pointers between this segment and adjoining segments are invalid
This error is *probably* associated with the following allocation:
A call to new for 10 bytes in testerr++.C on line 178.
This was the 5th call to new.
MALLOC Warning from new() (called from testerr++.C line 190):
Malloc region does not have valid magic number in header
MALLOC Fatal error from new() (called from testerr++.C line 190):
Pointer is not within malloc area
sh: 3616 Abort
Acknowledgement and Disclaimer