home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume32 / dbmalloc / part07 < prev    next >
SHell self-extracting ARchive  |  1992-09-04  |  56.4 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: SHell self-extracting ARchive (archive/shar).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert SHell self-extracting ARchive (archive/shar) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/329 Shell Archive Format default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 63 6f 6d 70 |Newsgrou|ps: comp|
|00000010| 2e 73 6f 75 72 63 65 73 | 2e 6d 69 73 63 0a 46 72 |.sources|.misc.Fr|
|00000020| 6f 6d 3a 20 63 70 63 61 | 68 69 6c 40 76 74 69 2e |om: cpca|hil@vti.|
|00000030| 63 6f 6d 20 28 43 6f 6e | 6f 72 20 50 2e 20 43 61 |com (Con|or P. Ca|
|00000040| 68 69 6c 6c 29 0a 53 75 | 62 6a 65 63 74 3a 20 20 |hill).Su|bject: |
|00000050| 76 33 32 69 30 31 32 3a | 20 20 64 62 6d 61 6c 6c |v32i012:| dbmall|
|00000060| 6f 63 20 2d 20 44 65 62 | 75 67 20 4d 61 6c 6c 6f |oc - Deb|ug Mallo|
|00000070| 63 20 4c 69 62 72 61 72 | 79 20 50 4c 31 34 2c 20 |c Librar|y PL14, |
|00000080| 50 61 72 74 30 37 2f 31 | 30 0a 4d 65 73 73 61 67 |Part07/1|0.Messag|
|00000090| 65 2d 49 44 3a 20 3c 31 | 39 39 32 53 65 70 34 2e |e-ID: <1|992Sep4.|
|000000a0| 31 35 32 33 30 30 2e 31 | 33 34 31 34 40 73 70 61 |152300.1|3414@spa|
|000000b0| 72 6b 79 2e 69 6d 64 2e | 73 74 65 72 6c 69 6e 67 |rky.imd.|sterling|
|000000c0| 2e 63 6f 6d 3e 0a 58 2d | 4d 64 34 2d 53 69 67 6e |.com>.X-|Md4-Sign|
|000000d0| 61 74 75 72 65 3a 20 31 | 64 35 65 39 36 31 37 39 |ature: 1|d5e96179|
|000000e0| 36 34 31 61 65 63 65 65 | 31 32 39 34 32 37 64 34 |641aecee|129427d4|
|000000f0| 35 33 65 32 39 33 30 0a | 44 61 74 65 3a 20 46 72 |53e2930.|Date: Fr|
|00000100| 69 2c 20 34 20 53 65 70 | 20 31 39 39 32 20 31 35 |i, 4 Sep| 1992 15|
|00000110| 3a 32 33 3a 30 30 20 47 | 4d 54 0a 41 70 70 72 6f |:23:00 G|MT.Appro|
|00000120| 76 65 64 3a 20 6b 65 6e | 74 40 73 70 61 72 6b 79 |ved: ken|t@sparky|
|00000130| 2e 69 6d 64 2e 73 74 65 | 72 6c 69 6e 67 2e 63 6f |.imd.ste|rling.co|
|00000140| 6d 0a 0a 53 75 62 6d 69 | 74 74 65 64 2d 62 79 3a |m..Submi|tted-by:|
|00000150| 20 63 70 63 61 68 69 6c | 40 76 74 69 2e 63 6f 6d | cpcahil|@vti.com|
|00000160| 20 28 43 6f 6e 6f 72 20 | 50 2e 20 43 61 68 69 6c | (Conor |P. Cahil|
|00000170| 6c 29 0a 50 6f 73 74 69 | 6e 67 2d 6e 75 6d 62 65 |l).Posti|ng-numbe|
|00000180| 72 3a 20 56 6f 6c 75 6d | 65 20 33 32 2c 20 49 73 |r: Volum|e 32, Is|
|00000190| 73 75 65 20 31 32 0a 41 | 72 63 68 69 76 65 2d 6e |sue 12.A|rchive-n|
|000001a0| 61 6d 65 3a 20 64 62 6d | 61 6c 6c 6f 63 2f 70 61 |ame: dbm|alloc/pa|
|000001b0| 72 74 30 37 0a 45 6e 76 | 69 72 6f 6e 6d 65 6e 74 |rt07.Env|ironment|
|000001c0| 3a 20 43 2c 20 55 4e 49 | 58 0a 0a 23 21 20 2f 62 |: C, UNI|X..#! /b|
|000001d0| 69 6e 2f 73 68 0a 23 20 | 54 68 69 73 20 69 73 20 |in/sh.# |This is |
|000001e0| 61 20 73 68 65 6c 6c 20 | 61 72 63 68 69 76 65 2e |a shell |archive.|
|000001f0| 20 20 52 65 6d 6f 76 65 | 20 61 6e 79 74 68 69 6e | Remove| anythin|
|00000200| 67 20 62 65 66 6f 72 65 | 20 74 68 69 73 20 6c 69 |g before| this li|
|00000210| 6e 65 2c 20 74 68 65 6e | 20 75 6e 70 61 63 6b 0a |ne, then| unpack.|
|00000220| 23 20 69 74 20 62 79 20 | 73 61 76 69 6e 67 20 69 |# it by |saving i|
|00000230| 74 20 69 6e 74 6f 20 61 | 20 66 69 6c 65 20 61 6e |t into a| file an|
|00000240| 64 20 74 79 70 69 6e 67 | 20 22 73 68 20 66 69 6c |d typing| "sh fil|
|00000250| 65 22 2e 20 20 54 6f 20 | 6f 76 65 72 77 72 69 74 |e". To |overwrit|
|00000260| 65 20 65 78 69 73 74 69 | 6e 67 0a 23 20 66 69 6c |e existi|ng.# fil|
|00000270| 65 73 2c 20 74 79 70 65 | 20 22 73 68 20 66 69 6c |es, type| "sh fil|
|00000280| 65 20 2d 63 22 2e 20 20 | 59 6f 75 20 63 61 6e 20 |e -c". |You can |
|00000290| 61 6c 73 6f 20 66 65 65 | 64 20 74 68 69 73 20 61 |also fee|d this a|
|000002a0| 73 20 73 74 61 6e 64 61 | 72 64 20 69 6e 70 75 74 |s standa|rd input|
|000002b0| 20 76 69 61 0a 23 20 75 | 6e 73 68 61 72 2c 20 6f | via.# u|nshar, o|
|000002c0| 72 20 62 79 20 74 79 70 | 69 6e 67 20 22 73 68 20 |r by typ|ing "sh |
|000002d0| 3c 66 69 6c 65 22 2c 20 | 65 2e 67 2e 2e 20 20 49 |<file", |e.g.. I|
|000002e0| 66 20 74 68 69 73 20 61 | 72 63 68 69 76 65 20 69 |f this a|rchive i|
|000002f0| 73 20 63 6f 6d 70 6c 65 | 74 65 2c 20 79 6f 75 0a |s comple|te, you.|
|00000300| 23 20 77 69 6c 6c 20 73 | 65 65 20 74 68 65 20 66 |# will s|ee the f|
|00000310| 6f 6c 6c 6f 77 69 6e 67 | 20 6d 65 73 73 61 67 65 |ollowing| message|
|00000320| 20 61 74 20 74 68 65 20 | 65 6e 64 3a 0a 23 09 09 | at the |end:.#..|
|00000330| 22 45 6e 64 20 6f 66 20 | 61 72 63 68 69 76 65 20 |"End of |archive |
|00000340| 37 20 28 6f 66 20 31 30 | 29 2e 22 0a 23 20 43 6f |7 (of 10|).".# Co|
|00000350| 6e 74 65 6e 74 73 3a 20 | 20 6d 61 6c 6c 6f 63 2e |ntents: | malloc.|
|00000360| 6d 61 6e 20 73 69 7a 65 | 2e 63 20 74 65 73 74 65 |man size|.c teste|
|00000370| 72 72 2e 63 0a 23 20 57 | 72 61 70 70 65 64 20 62 |rr.c.# W|rapped b|
|00000380| 79 20 63 70 63 61 68 69 | 6c 40 76 69 72 74 65 63 |y cpcahi|l@virtec|
|00000390| 68 20 6f 6e 20 54 68 75 | 20 53 65 70 20 20 33 20 |h on Thu| Sep 3 |
|000003a0| 31 38 3a 33 39 3a 32 30 | 20 31 39 39 32 0a 50 41 |18:39:20| 1992.PA|
|000003b0| 54 48 3d 2f 62 69 6e 3a | 2f 75 73 72 2f 62 69 6e |TH=/bin:|/usr/bin|
|000003c0| 3a 2f 75 73 72 2f 75 63 | 62 20 3b 20 65 78 70 6f |:/usr/uc|b ; expo|
|000003d0| 72 74 20 50 41 54 48 0a | 69 66 20 74 65 73 74 20 |rt PATH.|if test |
|000003e0| 2d 66 20 27 6d 61 6c 6c | 6f 63 2e 6d 61 6e 27 20 |-f 'mall|oc.man' |
|000003f0| 2d 61 20 22 24 7b 31 7d | 22 20 21 3d 20 22 2d 63 |-a "${1}|" != "-c|
|00000400| 22 20 3b 20 74 68 65 6e | 20 0a 20 20 65 63 68 6f |" ; then| . echo|
|00000410| 20 73 68 61 72 3a 20 57 | 69 6c 6c 20 6e 6f 74 20 | shar: W|ill not |
|00000420| 63 6c 6f 62 62 65 72 20 | 65 78 69 73 74 69 6e 67 |clobber |existing|
|00000430| 20 66 69 6c 65 20 5c 22 | 27 6d 61 6c 6c 6f 63 2e | file \"|'malloc.|
|00000440| 6d 61 6e 27 5c 22 0a 65 | 6c 73 65 0a 65 63 68 6f |man'\".e|lse.echo|
|00000450| 20 73 68 61 72 3a 20 45 | 78 74 72 61 63 74 69 6e | shar: E|xtractin|
|00000460| 67 20 5c 22 27 6d 61 6c | 6c 6f 63 2e 6d 61 6e 27 |g \"'mal|loc.man'|
|00000470| 5c 22 20 5c 28 34 35 31 | 34 30 20 63 68 61 72 61 |\" \(451|40 chara|
|00000480| 63 74 65 72 73 5c 29 0a | 73 65 64 20 22 73 2f 5e |cters\).|sed "s/^|
|00000490| 58 2f 2f 22 20 3e 27 6d | 61 6c 6c 6f 63 2e 6d 61 |X//" >'m|alloc.ma|
|000004a0| 6e 27 20 3c 3c 27 45 4e | 44 5f 4f 46 5f 46 49 4c |n' <<'EN|D_OF_FIL|
|000004b0| 45 27 0a 58 0a 58 0a 58 | 0a 58 20 20 20 20 20 44 |E'.X.X.X|.X D|
|000004c0| 45 42 55 47 5f 4d 41 4c | 4c 4f 43 28 33 29 09 09 |EBUG_MAL|LOC(3)..|
|000004d0| 20 20 20 28 56 54 49 29 | 09 20 20 20 20 20 20 20 | (VTI)|. |
|000004e0| 44 45 42 55 47 5f 4d 41 | 4c 4c 4f 43 28 33 29 0a |DEBUG_MA|LLOC(3).|
|000004f0| 58 0a 58 0a 58 0a 58 20 | 20 20 20 20 4e 41 4d 45 |X.X.X.X | NAME|
|00000500| 0a 58 09 20 20 64 62 6d | 61 6c 6c 6f 63 20 2d 20 |.X. dbm|alloc - |
|00000510| 64 65 62 75 67 67 69 6e | 67 20 6d 61 6c 6c 6f 63 |debuggin|g malloc|
|00000520| 20 6c 69 62 72 61 72 79 | 0a 58 0a 58 20 20 20 20 | library|.X.X |
|00000530| 20 53 59 4e 4f 50 53 49 | 53 0a 58 09 20 20 23 69 | SYNOPSI|S.X. #i|
|00000540| 6e 63 6c 75 64 65 20 3c | 6d 61 6c 6c 6f 63 2e 68 |nclude <|malloc.h|
|00000550| 3e 0a 58 0a 58 09 20 20 | 69 6e 74 20 6d 61 6c 6c |>.X.X. |int mall|
|00000560| 6f 63 5f 63 68 61 69 6e | 5f 63 68 65 63 6b 28 66 |oc_chain|_check(f|
|00000570| 6c 61 67 29 3b 0a 58 09 | 20 20 69 6e 74 20 66 6c |lag);.X.| int fl|
|00000580| 61 67 3b 0a 58 0a 58 09 | 20 20 76 6f 69 64 20 6d |ag;.X.X.| void m|
|00000590| 61 6c 6c 6f 63 5f 64 75 | 6d 70 28 66 64 29 3b 0a |alloc_du|mp(fd);.|
|000005a0| 58 09 20 20 69 6e 74 20 | 66 64 3b 0a 58 0a 58 09 |X. int |fd;.X.X.|
|000005b0| 20 20 76 6f 69 64 20 6d | 61 6c 6c 6f 63 5f 6c 69 | void m|alloc_li|
|000005c0| 73 74 28 66 64 2c 68 69 | 73 74 69 64 31 2c 68 69 |st(fd,hi|stid1,hi|
|000005d0| 73 74 69 64 32 29 3b 0a | 58 09 20 20 69 6e 74 20 |stid2);.|X. int |
|000005e0| 66 64 3b 0a 58 09 20 20 | 75 6e 73 69 67 6e 65 64 |fd;.X. |unsigned|
|000005f0| 20 6c 6f 6e 67 09 68 69 | 73 74 69 64 31 2c 20 68 | long.hi|stid1, h|
|00000600| 69 73 74 69 64 32 3b 0a | 58 0a 58 09 20 20 75 6e |istid2;.|X.X. un|
|00000610| 73 69 67 6e 65 64 20 6c | 6f 6e 67 09 6d 61 6c 6c |signed l|ong.mall|
|00000620| 6f 63 5f 69 6e 75 73 65 | 28 68 69 73 74 69 64 70 |oc_inuse|(histidp|
|00000630| 74 72 29 3b 0a 58 09 20 | 20 75 6e 73 69 67 6e 65 |tr);.X. | unsigne|
|00000640| 64 20 6c 6f 6e 67 09 2a | 20 68 69 73 74 69 64 70 |d long.*| histidp|
|00000650| 74 72 3b 0a 58 0a 58 09 | 20 20 76 6f 69 64 20 6d |tr;.X.X.| void m|
|00000660| 61 6c 6c 6f 63 5f 6d 61 | 72 6b 28 70 74 72 29 3b |alloc_ma|rk(ptr);|
|00000670| 0a 58 09 20 20 63 68 61 | 72 20 2a 20 70 74 72 3b |.X. cha|r * ptr;|
|00000680| 0a 58 0a 58 09 20 20 69 | 6e 74 20 64 62 6d 61 6c |.X.X. i|nt dbmal|
|00000690| 6c 6f 70 74 28 63 6d 64 | 2c 76 61 6c 29 3b 0a 58 |lopt(cmd|,val);.X|
|000006a0| 09 20 20 69 6e 74 20 63 | 6d 64 3b 0a 58 09 20 20 |. int c|md;.X. |
|000006b0| 75 6e 69 6f 6e 09 64 62 | 6d 61 6c 6c 6f 70 74 61 |union.db|mallopta|
|000006c0| 72 67 20 76 61 6c 3b 0a | 58 0a 58 09 20 20 76 6f |rg val;.|X.X. vo|
|000006d0| 69 64 20 6d 61 6c 6c 6f | 63 5f 61 62 6f 72 74 28 |id mallo|c_abort(|
|000006e0| 29 3b 0a 58 0a 58 09 20 | 20 76 6f 69 64 20 6d 61 |);.X.X. | void ma|
|000006f0| 6c 6c 6f 63 5f 65 6e 74 | 65 72 28 66 75 6e 63 29 |lloc_ent|er(func)|
|00000700| 3b 0a 58 09 20 20 63 68 | 61 72 20 2a 20 66 75 6e |;.X. ch|ar * fun|
|00000710| 63 3b 0a 58 0a 58 09 20 | 20 76 6f 69 64 20 6d 61 |c;.X.X. | void ma|
|00000720| 6c 6c 6f 63 5f 6c 65 61 | 76 65 28 66 75 6e 63 29 |lloc_lea|ve(func)|
|00000730| 3b 0a 58 09 20 20 63 68 | 61 72 20 2a 20 66 75 6e |;.X. ch|ar * fun|
|00000740| 63 3b 0a 58 0a 58 20 20 | 20 20 20 44 45 53 43 52 |c;.X.X | DESCR|
|00000750| 49 50 54 49 4f 4e 0a 58 | 09 20 20 54 68 69 73 20 |IPTION.X|. This |
|00000760| 6d 61 6c 6c 6f 63 20 6c | 69 62 72 61 72 79 20 69 |malloc l|ibrary i|
|00000770| 73 20 61 20 72 65 70 6c | 61 63 65 6d 65 6e 74 20 |s a repl|acement |
|00000780| 66 6f 72 20 74 68 65 20 | 73 74 61 6e 64 61 72 64 |for the |standard|
|00000790| 0a 58 09 20 20 6c 69 62 | 72 61 72 79 20 74 6f 20 |.X. lib|rary to |
|000007a0| 62 65 09 75 73 65 64 20 | 64 75 72 69 6e 67 20 73 |be.used |during s|
|000007b0| 6f 66 74 77 61 72 65 20 | 64 65 76 65 6c 6f 70 6d |oftware |developm|
|000007c0| 65 6e 74 2f 64 65 62 75 | 67 67 69 6e 67 2e 0a 58 |ent/debu|gging..X|
|000007d0| 09 20 20 53 65 65 20 74 | 68 65 20 73 74 61 6e 64 |. See t|he stand|
|000007e0| 61 72 64 20 6d 61 6c 6c | 6f 63 28 33 29 20 70 61 |ard mall|oc(3) pa|
|000007f0| 67 65 73 20 66 6f 72 20 | 6d 6f 72 65 20 69 6e 66 |ges for |more inf|
|00000800| 6f 72 6d 61 74 69 6f 6e | 09 6f 6e 20 74 68 65 0a |ormation|.on the.|
|00000810| 58 09 20 20 75 73 65 20 | 6f 66 20 74 68 65 20 66 |X. use |of the f|
|00000820| 6f 6c 6c 6f 77 69 6e 67 | 20 66 75 6e 63 74 69 6f |ollowing| functio|
|00000830| 6e 73 3a 0a 58 0a 58 09 | 20 20 20 20 20 20 20 63 |ns:.X.X.| c|
|00000840| 61 6c 6c 6f 63 28 29 2c | 20 63 66 72 65 65 28 29 |alloc(),| cfree()|
|00000850| 2c 20 66 72 65 65 28 29 | 2c 20 6d 61 6c 6c 6f 63 |, free()|, malloc|
|00000860| 28 29 2c 20 72 65 61 6c | 6c 6f 63 28 29 0a 58 0a |(), real|loc().X.|
|00000870| 58 09 20 20 54 68 69 73 | 20 6c 69 62 72 61 72 79 |X. This| library|
|00000880| 20 64 69 66 66 65 72 73 | 20 66 72 6f 6d 20 74 68 | differs| from th|
|00000890| 65 09 73 74 61 6e 64 61 | 72 64 20 6d 61 6c 6c 6f |e.standa|rd mallo|
|000008a0| 63 09 6c 69 62 72 61 72 | 79 09 69 6e 20 74 68 65 |c.librar|y.in the|
|000008b0| 0a 58 09 20 20 66 6f 6c | 6c 6f 77 69 6e 67 20 77 |.X. fol|lowing w|
|000008c0| 61 79 73 3a 0a 58 0a 58 | 09 20 20 31 2e 20 45 61 |ays:.X.X|. 1. Ea|
|000008d0| 63 68 20 6d 61 6c 6c 6f | 63 20 73 65 67 6d 65 6e |ch mallo|c segmen|
|000008e0| 74 20 63 6f 6e 74 61 69 | 6e 73 20 61 20 6d 61 67 |t contai|ns a mag|
|000008f0| 69 63 20 6e 75 6d 62 65 | 72 20 73 6f 20 74 68 61 |ic numbe|r so tha|
|00000900| 74 20 66 72 65 65 0a 58 | 09 20 20 63 61 6e 20 76 |t free.X|. can v|
|00000910| 65 72 69 66 79 20 74 68 | 61 74 20 74 68 65 20 70 |erify th|at the p|
|00000920| 6f 69 6e 74 65 72 20 70 | 61 73 73 65 64 20 70 6f |ointer p|assed po|
|00000930| 69 6e 74 73 20 74 6f 20 | 61 20 76 61 6c 69 64 20 |ints to |a valid |
|00000940| 6d 61 6c 6c 6f 63 0a 58 | 09 20 20 73 65 67 6d 65 |malloc.X|. segme|
|00000950| 6e 74 2e 0a 58 0a 58 09 | 20 20 32 2e 20 45 61 63 |nt..X.X.| 2. Eac|
|00000960| 68 20 6d 61 6c 6c 6f 63 | 20 73 65 67 6d 65 6e 74 |h malloc| segment|
|00000970| 20 69 73 20 66 69 6c 6c | 65 64 20 77 69 74 68 09 | is fill|ed with.|
|00000980| 61 20 6e 6f 6e 2d 7a 65 | 72 6f 20 70 61 74 74 65 |a non-ze|ro patte|
|00000990| 72 6e 20 73 6f 0a 58 09 | 20 20 74 68 61 74 20 63 |rn so.X.| that c|
|000009a0| 6f 64 65 20 74 68 61 74 | 20 64 65 70 65 6e 64 73 |ode that| depends|
|000009b0| 20 75 70 6f 6e 20 6d 61 | 6c 6c 6f 63 20 73 65 67 | upon ma|lloc seg|
|000009c0| 6d 65 6e 74 73 20 62 65 | 69 6e 67 20 6e 75 6c 6c |ments be|ing null|
|000009d0| 20 77 69 6c 6c 0a 58 09 | 20 20 66 61 69 6c 2e 0a | will.X.| fail..|
|000009e0| 58 0a 58 0a 58 0a 58 20 | 20 20 20 20 50 61 67 65 |X.X.X.X | Page|
|000009f0| 20 31 09 09 09 20 20 20 | 31 2e 31 31 0a 58 0a 58 | 1... |1.11.X.X|
|00000a00| 0a 58 0a 58 0a 58 0a 58 | 0a 58 20 20 20 20 20 44 |.X.X.X.X|.X D|
|00000a10| 45 42 55 47 5f 4d 41 4c | 4c 4f 43 28 33 29 09 09 |EBUG_MAL|LOC(3)..|
|00000a20| 20 20 20 28 56 54 49 29 | 09 20 20 20 20 20 20 20 | (VTI)|. |
|00000a30| 44 45 42 55 47 5f 4d 41 | 4c 4c 4f 43 28 33 29 0a |DEBUG_MA|LLOC(3).|
|00000a40| 58 0a 58 0a 58 0a 58 09 | 20 20 33 2e 20 54 68 65 |X.X.X.X.| 3. The|
|00000a50| 20 73 69 7a 65 20 6f 66 | 20 65 61 63 68 20 73 65 | size of| each se|
|00000a60| 67 6d 65 6e 74 20 77 69 | 6c 6c 20 62 65 20 61 74 |gment wi|ll be at|
|00000a70| 20 6c 65 61 73 74 20 31 | 20 62 79 74 65 20 6c 61 | least 1| byte la|
|00000a80| 72 67 65 72 0a 58 09 20 | 20 74 68 61 6e 20 72 65 |rger.X. | than re|
|00000a90| 71 75 65 73 74 65 64 20 | 61 6e 64 20 74 68 65 20 |quested |and the |
|00000aa0| 65 78 74 72 61 20 62 79 | 74 65 73 20 77 69 6c 6c |extra by|tes will|
|00000ab0| 20 62 65 20 66 69 6c 6c | 65 64 20 77 69 74 68 20 | be fill|ed with |
|00000ac0| 61 0a 58 09 20 20 6e 6f | 6e 2d 7a 65 72 6f 20 70 |a.X. no|n-zero p|
|00000ad0| 61 74 74 65 72 6e 2e 20 | 20 57 68 65 6e 20 66 72 |attern. | When fr|
|00000ae0| 65 65 20 69 73 20 63 61 | 6c 6c 65 64 2c 20 69 74 |ee is ca|lled, it|
|00000af0| 20 77 69 6c 6c 20 76 65 | 72 69 66 79 20 74 68 61 | will ve|rify tha|
|00000b00| 74 0a 58 09 20 20 79 6f | 75 20 64 69 64 20 6e 6f |t.X. yo|u did no|
|00000b10| 74 20 67 6f 20 62 65 79 | 6f 6e 64 09 74 68 65 20 |t go bey|ond.the |
|00000b20| 6e 75 6d 62 65 72 20 6f | 66 20 62 79 74 65 73 20 |number o|f bytes |
|00000b30| 79 6f 75 09 61 73 6b 65 | 64 20 66 6f 72 2e 0a 58 |you.aske|d for..X|
|00000b40| 0a 58 09 20 20 34 2e 20 | 57 68 65 6e 20 61 20 73 |.X. 4. |When a s|
|00000b50| 65 67 6d 65 6e 74 20 69 | 73 20 66 72 65 65 64 2c |egment i|s freed,|
|00000b60| 20 69 74 20 77 69 6c 6c | 20 62 65 20 66 69 6c 6c | it will| be fill|
|00000b70| 65 64 09 77 69 74 68 20 | 61 0a 58 09 20 20 64 69 |ed.with |a.X. di|
|00000b80| 66 66 65 72 65 6e 74 20 | 6e 6f 6e 2d 7a 65 72 6f |fferent |non-zero|
|00000b90| 20 70 61 74 74 65 72 6e | 20 74 6f 09 65 6e 73 75 | pattern| to.ensu|
|00000ba0| 72 65 20 74 68 61 74 20 | 74 68 65 09 70 72 6f 67 |re that |the.prog|
|00000bb0| 72 61 6d 0a 58 09 20 20 | 64 6f 65 73 6e 27 74 20 |ram.X. |doesn't |
|00000bc0| 64 65 70 65 6e 64 20 75 | 70 6f 6e 20 74 68 65 20 |depend u|pon the |
|00000bd0| 75 73 65 20 6f 66 20 61 | 6c 72 65 61 64 79 20 66 |use of a|lready f|
|00000be0| 72 65 65 64 20 64 61 74 | 61 2e 0a 58 0a 58 09 20 |reed dat|a..X.X. |
|00000bf0| 20 35 2e 20 57 68 65 6e | 65 76 65 72 20 61 6e 79 | 5. When|ever any|
|00000c00| 20 6f 66 20 74 68 65 20 | 73 74 72 69 6e 67 09 6f | of the |string.o|
|00000c10| 72 20 6d 65 6d 6f 72 79 | 20 66 75 6e 63 74 69 6f |r memory| functio|
|00000c20| 6e 73 20 28 73 74 72 2a | 2c 20 62 2a 2c 0a 58 09 |ns (str*|, b*,.X.|
|00000c30| 20 20 6d 65 6d 2a 29 09 | 61 72 65 20 63 61 6c 6c | mem*).|are call|
|00000c40| 65 64 20 77 69 74 68 09 | 61 20 70 6f 69 6e 74 65 |ed with.|a pointe|
|00000c50| 72 20 74 68 61 74 20 69 | 73 20 77 69 74 68 69 6e |r that i|s within|
|00000c60| 20 74 68 65 20 6d 61 6c | 6c 6f 63 0a 58 09 20 20 | the mal|loc.X. |
|00000c70| 61 72 65 6e 61 2c 20 20 | 74 68 65 20 6f 70 65 72 |arena, |the oper|
|00000c80| 61 74 69 6f 6e 09 69 73 | 20 63 68 65 63 6b 65 64 |ation.is| checked|
|00000c90| 20 74 6f 20 76 65 72 69 | 66 79 20 74 68 61 74 20 | to veri|fy that |
|00000ca0| 69 74 20 64 6f 65 73 20 | 6e 6f 74 0a 58 09 20 20 |it does |not.X. |
|00000cb0| 6f 76 65 72 72 75 6e 20 | 74 68 65 20 6d 61 6c 6c |overrun |the mall|
|00000cc0| 6f 63 65 64 20 73 65 67 | 6d 65 6e 74 2e 09 20 41 |oced seg|ment.. A|
|00000cd0| 20 66 61 69 6c 75 72 65 | 20 6f 66 20 74 68 69 73 | failure| of this|
|00000ce0| 20 63 68 65 63 6b 20 69 | 73 0a 58 09 20 20 63 6f | check i|s.X. co|
|00000cf0| 6e 73 69 64 65 72 65 64 | 20 61 20 22 77 61 72 6e |nsidered| a "warn|
|00000d00| 69 6e 67 09 6c 65 76 65 | 6c 20 65 72 72 6f 72 22 |ing.leve|l error"|
|00000d10| 20 28 64 65 73 63 72 69 | 62 65 64 09 6c 61 74 65 | (descri|bed.late|
|00000d20| 72 29 20 61 6e 64 20 69 | 73 0a 58 09 20 20 68 61 |r) and i|s.X. ha|
|00000d30| 6e 64 6c 65 64 20 61 63 | 63 6f 72 64 69 6e 67 6c |ndled ac|cordingl|
|00000d40| 79 2e 0a 58 0a 58 09 20 | 20 36 2e 20 52 75 6e 20 |y..X.X. | 6. Run |
|00000d50| 74 69 6d 65 20 63 68 65 | 63 6b 69 6e 67 20 63 61 |time che|cking ca|
|00000d60| 6e 20 69 6e 63 6c 75 64 | 65 20 76 65 72 69 66 69 |n includ|e verifi|
|00000d70| 63 61 74 69 6f 6e 09 6f | 66 20 74 68 65 20 6d 61 |cation.o|f the ma|
|00000d80| 6c 6c 6f 63 0a 58 09 20 | 20 63 68 61 69 6e 09 61 |lloc.X. | chain.a|
|00000d90| 74 20 65 61 63 68 09 61 | 6e 64 20 65 76 65 72 79 |t each.a|nd every|
|00000da0| 20 63 61 6c 6c 20 74 6f | 20 6f 6e 65 20 6f 66 20 | call to| one of |
|00000db0| 74 68 65 20 6d 61 6c 6c | 6f 63 20 66 75 6e 63 74 |the mall|oc funct|
|00000dc0| 69 6f 6e 73 0a 58 09 20 | 20 6f 72 20 6d 61 6e 75 |ions.X. | or manu|
|00000dd0| 61 6c 6c 79 20 62 79 20 | 63 61 6c 6c 69 6e 67 20 |ally by |calling |
|00000de0| 74 68 65 20 6d 61 6c 6c | 6f 63 5f 63 68 61 69 6e |the mall|oc_chain|
|00000df0| 5f 63 68 65 63 6b 09 66 | 75 6e 63 74 69 6f 6e 2e |_check.f|unction.|
|00000e00| 0a 58 0a 58 09 20 20 37 | 2e 20 45 78 74 65 6e 73 |.X.X. 7|. Extens|
|00000e10| 69 76 65 20 73 75 70 70 | 6f 72 74 20 66 6f 72 20 |ive supp|ort for |
|00000e20| 74 72 61 63 6b 69 6e 67 | 20 6d 65 6d 6f 72 79 20 |tracking| memory |
|00000e30| 6c 65 61 6b 73 20 69 73 | 20 70 72 6f 76 69 64 65 |leaks is| provide|
|00000e40| 64 2e 0a 58 0a 58 09 20 | 20 57 68 65 6e 20 61 20 |d..X.X. | When a |
|00000e50| 70 72 6f 62 6c 65 6d 20 | 69 73 20 66 6f 75 6e 64 |problem |is found|
|00000e60| 2c 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |, the fo|llowing |
|00000e70| 65 72 72 6f 72 20 6d 65 | 73 73 61 67 65 20 69 73 |error me|ssage is|
|00000e80| 0a 58 09 20 20 64 69 73 | 70 6c 61 79 65 64 3a 0a |.X. dis|played:.|
|00000e90| 58 0a 58 09 20 20 20 20 | 20 20 20 4d 41 4c 4c 4f |X.X. | MALLO|
|00000ea0| 43 20 57 61 72 6e 69 6e | 67 20 66 72 6f 6d 20 66 |C Warnin|g from f|
|00000eb0| 75 6e 63 6e 61 6d 65 28 | 29 20 28 63 61 6c 6c 65 |uncname(|) (calle|
|00000ec0| 64 20 66 72 6f 6d 20 66 | 69 6c 65 6e 61 6d 65 2e |d from f|ilename.|
|00000ed0| 63 20 6c 69 6e 65 20 23 | 23 23 29 3a 0a 58 09 20 |c line #|##):.X. |
|00000ee0| 20 20 20 20 20 20 57 61 | 72 6e 69 6e 67 20 6d 65 | Wa|rning me|
|00000ef0| 73 73 61 67 65 20 67 6f | 65 73 20 68 65 72 65 0a |ssage go|es here.|
|00000f00| 58 0a 58 09 20 20 66 75 | 6e 63 6e 61 6d 65 20 69 |X.X. fu|ncname i|
|00000f10| 73 20 74 68 65 20 6e 61 | 6d 65 20 6f 66 20 74 68 |s the na|me of th|
|00000f20| 65 20 66 75 6e 63 74 69 | 6f 6e 20 74 68 61 74 20 |e functi|on that |
|00000f30| 68 61 73 09 66 6f 75 6e | 64 20 74 68 65 0a 58 09 |has.foun|d the.X.|
|00000f40| 20 20 70 72 6f 62 6c 65 | 6d 20 61 6e 64 20 77 69 | proble|m and wi|
|00000f50| 6c 6c 20 75 73 75 61 6c | 6c 79 20 62 65 20 61 6e |ll usual|ly be an|
|00000f60| 20 65 6e 74 72 79 20 70 | 6f 69 6e 74 20 69 6e 74 | entry p|oint int|
|00000f70| 6f 20 74 68 65 20 6c 69 | 62 72 61 72 79 2e 0a 58 |o the li|brary..X|
|00000f80| 09 20 20 54 68 65 20 69 | 6e 66 6f 72 6d 61 74 69 |. The i|nformati|
|00000f90| 6f 6e 20 74 68 61 74 20 | 69 64 65 6e 74 69 66 69 |on that |identifi|
|00000fa0| 65 73 20 77 68 65 72 65 | 09 74 68 65 20 66 75 6e |es where|.the fun|
|00000fb0| 63 74 69 6f 6e 20 69 73 | 09 63 61 6c 6c 65 64 0a |ction is|.called.|
|00000fc0| 58 09 20 20 66 72 6f 6d | 20 77 69 6c 6c 20 6f 6e |X. from| will on|
|00000fd0| 6c 79 20 62 65 20 61 76 | 61 69 6c 61 62 6c 65 20 |ly be av|ailable |
|00000fe0| 69 66 20 74 68 65 20 73 | 6f 75 72 63 65 20 6d 6f |if the s|ource mo|
|00000ff0| 64 75 6c 65 20 77 61 73 | 0a 58 09 20 20 63 6f 6d |dule was|.X. com|
|00001000| 70 69 6c 65 64 20 77 69 | 74 68 09 74 68 65 20 6d |piled wi|th.the m|
|00001010| 61 6c 6c 6f 63 2e 68 20 | 66 69 6c 65 20 69 6e 63 |alloc.h |file inc|
|00001020| 6c 75 64 65 64 2e 0a 58 | 0a 58 09 20 20 49 66 20 |luded..X|.X. If |
|00001030| 74 68 65 20 65 72 72 6f | 72 20 69 73 20 63 61 75 |the erro|r is cau|
|00001040| 73 65 64 20 62 79 20 61 | 20 70 72 6f 62 6c 65 6d |sed by a| problem|
|00001050| 20 69 6e 20 74 68 65 20 | 6d 61 6c 6c 6f 63 20 63 | in the |malloc c|
|00001060| 68 61 69 6e 20 61 6e 64 | 0a 58 09 20 20 74 68 65 |hain and|.X. the|
|00001070| 20 6f 66 66 65 6e 64 69 | 6e 67 09 63 68 61 69 6e | offendi|ng.chain|
|00001080| 20 65 6c 65 6d 65 6e 74 | 20 63 61 6e 20 62 65 20 | element| can be |
|00001090| 69 64 65 6e 74 69 66 69 | 65 64 2c 20 74 68 65 20 |identifi|ed, the |
|000010a0| 66 6f 6c 6c 6f 77 69 6e | 67 0a 58 09 20 20 69 6e |followin|g.X. in|
|000010b0| 66 6f 72 6d 61 74 69 6f | 6e 20 69 73 20 61 6c 73 |formatio|n is als|
|000010c0| 6f 20 64 69 73 70 6c 61 | 79 65 64 09 28 4e 4f 54 |o displa|yed.(NOT|
|000010d0| 45 3a 20 74 68 69 73 20 | 69 73 20 6a 75 73 74 20 |E: this |is just |
|000010e0| 61 20 67 75 65 73 73 20 | 62 79 0a 58 09 20 20 74 |a guess |by.X. t|
|000010f0| 68 65 20 73 6f 66 74 77 | 61 72 65 2c 09 69 74 20 |he softw|are,.it |
|00001100| 6d 61 79 20 6e 6f 74 20 | 62 65 20 74 68 65 20 61 |may not |be the a|
|00001110| 63 74 75 61 6c 20 63 75 | 6c 70 72 69 74 29 3a 0a |ctual cu|lprit):.|
|00001120| 58 0a 58 09 20 20 20 20 | 20 20 20 54 68 69 73 20 |X.X. | This |
|00001130| 65 72 72 6f 72 20 69 73 | 20 2a 70 72 6f 62 61 62 |error is| *probab|
|00001140| 6c 79 2a 09 61 73 73 6f | 63 69 61 74 65 64 20 77 |ly*.asso|ciated w|
|00001150| 69 74 68 09 74 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |ith.the |followin|
|00001160| 67 20 61 6c 6c 6f 63 61 | 74 69 6f 6e 3a 0a 58 0a |g alloca|tion:.X.|
|00001170| 58 09 09 20 20 41 20 63 | 61 6c 6c 20 74 6f 20 6d |X.. A c|all to m|
|00001180| 61 6c 6c 6f 63 20 66 6f | 72 20 33 33 20 62 79 74 |alloc fo|r 33 byt|
|00001190| 65 73 09 69 6e 20 70 72 | 6f 67 72 61 6d 2e 63 20 |es.in pr|ogram.c |
|000011a0| 6f 6e 09 6c 69 6e 65 20 | 38 33 34 2e 0a 58 09 09 |on.line |834..X..|
|000011b0| 20 20 54 68 69 73 20 77 | 61 73 20 74 68 65 20 31 | This w|as the 1|
|000011c0| 37 32 6e 64 20 63 61 6c | 6c 20 74 6f 20 6d 61 6c |72nd cal|l to mal|
|000011d0| 6c 6f 63 2e 0a 58 0a 58 | 0a 58 0a 58 0a 58 0a 58 |loc..X.X|.X.X.X.X|
|000011e0| 0a 58 0a 58 0a 58 0a 58 | 0a 58 0a 58 0a 58 20 20 |.X.X.X.X|.X.X.X |
|000011f0| 20 20 20 50 61 67 65 20 | 32 09 09 09 20 20 20 31 | Page |2... 1|
|00001200| 2e 31 31 0a 58 0a 58 0a | 58 0a 58 0a 58 0a 58 0a |.11.X.X.|X.X.X.X.|
|00001210| 58 20 20 20 20 20 44 45 | 42 55 47 5f 4d 41 4c 4c |X DE|BUG_MALL|
|00001220| 4f 43 28 33 29 09 09 20 | 20 20 28 56 54 49 29 09 |OC(3).. | (VTI).|
|00001230| 20 20 20 20 20 20 20 44 | 45 42 55 47 5f 4d 41 4c | D|EBUG_MAL|
|00001240| 4c 4f 43 28 33 29 0a 58 | 0a 58 0a 58 0a 58 09 20 |LOC(3).X|.X.X.X. |
|00001250| 20 54 68 69 73 20 65 78 | 61 6d 70 6c 65 20 61 73 | This ex|ample as|
|00001260| 73 75 6d 65 73 20 74 68 | 61 74 20 70 72 6f 67 72 |sumes th|at progr|
|00001270| 61 6d 2e 63 20 69 6e 63 | 6c 75 64 65 64 20 74 68 |am.c inc|luded th|
|00001280| 65 20 64 65 62 75 67 67 | 69 6e 67 0a 58 09 20 20 |e debugg|ing.X. |
|00001290| 6c 69 62 72 61 72 79 20 | 6d 61 6c 6c 6f 63 2e 68 |library |malloc.h|
|000012a0| 20 66 69 6c 65 2e 20 20 | 49 66 20 6e 6f 74 2c 20 | file. |If not, |
|000012b0| 74 68 65 20 69 64 65 6e | 74 69 66 69 63 61 74 69 |the iden|tificati|
|000012c0| 6f 6e 0a 58 09 20 20 69 | 6e 66 6f 72 6d 61 74 69 |on.X. i|nformati|
|000012d0| 6f 6e 20 77 69 6c 6c 20 | 62 65 20 61 73 20 66 6f |on will |be as fo|
|000012e0| 6c 6c 6f 77 73 3a 0a 58 | 0a 58 09 20 20 20 20 20 |llows:.X|.X. |
|000012f0| 20 20 54 68 69 73 20 65 | 72 72 6f 72 20 69 73 20 | This e|rror is |
|00001300| 2a 70 72 6f 62 61 62 6c | 79 2a 09 61 73 73 6f 63 |*probabl|y*.assoc|
|00001310| 69 61 74 65 64 20 77 69 | 74 68 09 74 68 65 20 66 |iated wi|th.the f|
|00001320| 6f 6c 6c 6f 77 69 6e 67 | 20 61 6c 6c 6f 63 61 74 |ollowing| allocat|
|00001330| 69 6f 6e 3a 0a 58 0a 58 | 09 09 20 20 41 20 63 61 |ion:.X.X|.. A ca|
|00001340| 6c 6c 20 74 6f 20 6d 61 | 6c 6c 6f 63 20 66 6f 72 |ll to ma|lloc for|
|00001350| 20 33 33 20 62 79 74 65 | 73 09 69 6e 20 61 6e 20 | 33 byte|s.in an |
|00001360| 75 6e 6b 6e 6f 77 6e 20 | 66 69 6c 65 2e 0a 58 09 |unknown |file..X.|
|00001370| 09 20 20 54 68 69 73 20 | 77 61 73 20 74 68 65 20 |. This |was the |
|00001380| 31 37 32 6e 64 20 63 61 | 6c 6c 20 74 6f 20 6d 61 |172nd ca|ll to ma|
|00001390| 6c 6c 6f 63 2e 0a 58 0a | 58 09 20 20 54 68 65 20 |lloc..X.|X. The |
|000013a0| 69 64 65 6e 74 69 66 69 | 63 61 74 69 6f 6e 20 6f |identifi|cation o|
|000013b0| 66 09 77 68 69 63 68 20 | 63 61 6c 6c 20 74 6f 20 |f.which |call to |
|000013c0| 6d 61 6c 6c 6f 63 20 69 | 73 09 61 73 73 6f 63 69 |malloc i|s.associ|
|000013d0| 61 74 65 64 0a 58 09 20 | 20 77 69 74 68 20 74 68 |ated.X. | with th|
|000013e0| 65 20 70 72 6f 62 6c 65 | 6d 20 69 73 20 68 65 6c |e proble|m is hel|
|000013f0| 70 66 75 6c 20 69 6e 20 | 74 68 61 74 20 69 74 20 |pful in |that it |
|00001400| 67 69 76 65 73 20 79 6f | 75 20 74 68 65 0a 58 09 |gives yo|u the.X.|
|00001410| 20 20 69 6e 66 6f 72 6d | 61 74 69 6f 6e 20 6e 65 | inform|ation ne|
|00001420| 63 65 73 73 61 72 79 09 | 74 6f 20 73 65 74 20 74 |cessary.|to set t|
|00001430| 68 65 20 62 72 65 61 6b | 70 6f 69 6e 74 20 6f 6e |he break|point on|
|00001440| 20 74 68 65 0a 58 09 20 | 20 61 6c 6c 6f 63 61 74 | the.X. | allocat|
|00001450| 69 6f 6e 20 66 75 6e 63 | 74 69 6f 6e 20 66 6f 72 |ion func|tion for|
|00001460| 20 74 68 61 74 20 70 61 | 72 74 69 63 75 6c 61 72 | that pa|rticular|
|00001470| 20 69 6e 76 6f 63 61 74 | 69 6f 6e 0a 58 09 20 20 | invocat|ion.X. |
|00001480| 28 62 72 65 61 6b 70 6f | 69 6e 74 73 20 75 73 75 |(breakpo|ints usu|
|00001490| 61 6c 6c 79 20 63 61 6e | 20 68 61 76 65 09 63 6f |ally can| have.co|
|000014a0| 75 6e 74 65 72 73 20 61 | 73 73 6f 63 69 61 74 65 |unters a|ssociate|
|000014b0| 64 20 77 69 74 68 0a 58 | 09 20 20 74 68 65 6d 29 |d with.X|. them)|
|000014c0| 2e 20 20 54 68 65 20 63 | 6f 75 6e 74 65 72 73 20 |. The c|ounters |
|000014d0| 66 6f 72 20 74 68 65 20 | 74 68 72 65 65 20 70 72 |for the |three pr|
|000014e0| 69 6d 61 72 79 20 61 6c | 6c 6f 63 61 74 69 6f 6e |imary al|location|
|000014f0| 09 65 6e 74 72 79 0a 58 | 09 20 20 70 6f 69 6e 74 |.entry.X|. point|
|00001500| 73 20 28 6d 61 6c 6c 6f | 63 2c 20 63 61 6c 6c 6f |s (mallo|c, callo|
|00001510| 63 2c 20 61 6e 64 20 72 | 65 61 6c 6c 6f 63 29 20 |c, and r|ealloc) |
|00001520| 61 72 65 20 6d 61 6e 61 | 67 65 64 20 73 65 70 61 |are mana|ged sepa|
|00001530| 72 61 74 65 6c 79 2e 0a | 58 0a 58 09 20 20 4e 4f |rately..|X.X. NO|
|00001540| 54 45 20 31 3a 20 69 66 | 20 79 6f 75 20 77 61 6e |TE 1: if| you wan|
|00001550| 74 20 74 6f 20 73 65 74 | 20 61 20 62 72 65 61 6b |t to set| a break|
|00001560| 70 6f 69 6e 74 20 74 6f | 20 63 61 70 74 75 72 65 |point to| capture|
|00001570| 20 74 68 69 73 0a 58 09 | 20 20 69 6e 76 6f 63 61 | this.X.| invoca|
|00001580| 74 69 6f 6e 20 6f 66 09 | 6d 61 6c 6c 6f 63 2c 09 |tion of.|malloc,.|
|00001590| 74 68 65 20 61 63 74 75 | 61 6c 20 66 75 6e 63 74 |the actu|al funct|
|000015a0| 69 6f 6e 20 74 68 61 74 | 20 69 73 20 62 65 69 6e |ion that| is bein|
|000015b0| 67 0a 58 09 20 20 63 61 | 6c 6c 65 64 20 69 73 20 |g.X. ca|lled is |
|000015c0| 64 65 62 75 67 5f 6d 61 | 6c 6c 6f 63 20 28 6f 72 |debug_ma|lloc (or|
|000015d0| 20 64 65 62 75 67 5f 72 | 65 61 6c 6c 6f 63 20 66 | debug_r|ealloc f|
|000015e0| 6f 72 20 72 65 61 6c 6c | 6f 63 20 61 6e 64 0a 58 |or reall|oc and.X|
|000015f0| 09 20 20 64 65 62 75 67 | 5f 63 61 6c 6c 6f 63 20 |. debug|_calloc |
|00001600| 66 6f 72 20 63 61 6c 6c | 6f 63 29 20 61 6e 64 20 |for call|oc) and |
|00001610| 74 68 61 74 20 69 73 20 | 77 68 65 72 65 20 74 68 |that is |where th|
|00001620| 65 20 62 72 65 61 6b 70 | 6f 69 6e 74 0a 58 09 20 |e breakp|oint.X. |
|00001630| 20 73 68 6f 75 6c 64 20 | 62 65 20 73 65 74 2e 0a | should |be set..|
|00001640| 58 0a 58 09 20 20 4e 4f | 54 45 20 32 3a 20 53 69 |X.X. NO|TE 2: Si|
|00001650| 6e 63 65 09 74 68 65 20 | 73 6f 66 74 77 61 72 65 |nce.the |software|
|00001660| 20 69 73 09 67 75 65 73 | 73 69 6e 67 20 61 74 20 | is.gues|sing at |
|00001670| 74 68 65 09 6f 66 66 65 | 6e 64 69 6e 67 0a 58 09 |the.offe|nding.X.|
|00001680| 20 20 6d 61 6c 6c 6f 63 | 20 63 68 61 69 6e 20 73 | malloc| chain s|
|00001690| 65 67 6d 65 6e 74 2c 09 | 69 74 20 69 73 20 70 6f |egment,.|it is po|
|000016a0| 73 73 69 62 6c 65 20 74 | 68 61 74 20 6f 6e 65 09 |ssible t|hat one.|
|000016b0| 6f 66 20 74 68 65 20 6e | 65 61 72 62 79 0a 58 09 |of the n|earby.X.|
|000016c0| 20 20 73 65 67 6d 65 6e | 74 73 20 69 73 20 61 63 | segmen|ts is ac|
|000016d0| 74 75 61 6c 6c 79 20 74 | 68 65 20 63 75 6c 70 72 |tually t|he culpr|
|000016e0| 69 74 2e 20 20 49 66 09 | 74 68 65 20 65 6e 76 69 |it. If.|the envi|
|000016f0| 72 6f 6e 6d 65 6e 74 0a | 58 09 20 20 76 61 72 69 |ronment.|X. vari|
|00001700| 61 62 6c 65 20 4d 41 4c | 4c 4f 43 5f 53 48 4f 57 |able MAL|LOC_SHOW|
|00001710| 5f 4c 49 4e 4b 53 20 69 | 73 09 73 65 74 2c 20 62 |_LINKS i|s.set, b|
|00001720| 6f 74 68 20 74 68 65 20 | 73 65 67 6d 65 6e 74 0a |oth the |segment.|
|00001730| 58 09 20 20 70 72 65 63 | 65 64 69 6e 67 20 61 6e |X. prec|eding an|
|00001740| 64 09 74 68 65 20 73 65 | 67 6d 65 6e 74 20 66 6f |d.the se|gment fo|
|00001750| 6c 6c 6f 77 69 6e 67 20 | 74 68 65 20 61 63 63 75 |llowing |the accu|
|00001760| 73 65 64 20 73 65 67 6d | 65 6e 74 20 77 69 6c 6c |sed segm|ent will|
|00001770| 0a 58 09 20 20 61 6c 73 | 6f 20 62 65 20 69 64 65 |.X. als|o be ide|
|00001780| 6e 74 69 66 69 65 64 2e | 20 20 54 68 65 20 66 6f |ntified.| The fo|
|00001790| 6c 6c 6f 77 69 6e 67 20 | 69 73 09 61 20 73 61 6d |llowing |is.a sam|
|000017a0| 70 6c 65 20 6f 75 74 70 | 75 74 3a 0a 58 0a 58 09 |ple outp|ut:.X.X.|
|000017b0| 20 20 20 20 20 20 20 54 | 68 69 73 20 65 72 72 6f | T|his erro|
|000017c0| 72 20 69 73 20 2a 70 72 | 6f 62 61 62 6c 79 2a 09 |r is *pr|obably*.|
|000017d0| 61 73 73 6f 63 69 61 74 | 65 64 20 77 69 74 68 09 |associat|ed with.|
|000017e0| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 61 6c |the foll|owing al|
|000017f0| 6c 6f 63 61 74 69 6f 6e | 3a 0a 58 0a 58 09 09 20 |location|:.X.X.. |
|00001800| 20 20 41 20 63 61 6c 6c | 20 74 6f 20 6d 61 6c 6c | A call| to mall|
|00001810| 6f 63 20 66 6f 72 09 33 | 33 20 62 79 74 65 73 20 |oc for.3|3 bytes |
|00001820| 69 6e 20 61 6e 20 75 6e | 6b 6e 6f 77 6e 20 66 69 |in an un|known fi|
|00001830| 6c 65 2e 0a 58 09 09 20 | 20 20 54 68 69 73 09 77 |le..X.. | This.w|
|00001840| 61 73 20 74 68 65 09 31 | 37 32 6e 64 20 63 61 6c |as the.1|72nd cal|
|00001850| 6c 20 74 6f 20 6d 61 6c | 6c 6f 63 2e 0a 58 0a 58 |l to mal|loc..X.X|
|00001860| 09 09 20 20 20 54 68 65 | 20 6d 61 6c 6c 6f 63 20 |.. The| malloc |
|00001870| 63 68 61 69 6e 20 65 6c | 65 6d 65 6e 74 20 70 72 |chain el|ement pr|
|00001880| 69 6f 72 20 74 6f 20 74 | 68 65 20 73 75 73 70 65 |ior to t|he suspe|
|00001890| 63 74 20 61 6c 6c 6f 63 | 61 74 69 6f 6e 20 69 73 |ct alloc|ation is|
|000018a0| 20 66 72 6f 6d 3a 0a 58 | 0a 58 09 09 20 20 20 41 | from:.X|.X.. A|
|000018b0| 20 63 61 6c 6c 20 74 6f | 20 63 61 6c 6c 6f 63 20 | call to| calloc |
|000018c0| 66 6f 72 09 35 31 32 20 | 62 79 74 65 73 20 69 6e |for.512 |bytes in|
|000018d0| 20 6d 61 69 6e 2e 63 20 | 6c 69 6e 65 20 31 36 2e | main.c |line 16.|
|000018e0| 0a 58 09 09 20 20 20 54 | 68 69 73 09 77 61 73 20 |.X.. T|his.was |
|000018f0| 74 68 65 09 34 74 68 20 | 63 61 6c 6c 20 74 6f 20 |the.4th |call to |
|00001900| 63 61 6c 6c 6f 63 2e 0a | 58 09 09 20 20 20 54 68 |calloc..|X.. Th|
|00001910| 69 73 09 62 6c 6f 63 6b | 20 77 61 73 20 66 72 65 |is.block| was fre|
|00001920| 65 64 09 6f 6e 20 74 68 | 65 20 32 6e 64 20 63 61 |ed.on th|e 2nd ca|
|00001930| 6c 6c 09 74 6f 20 66 72 | 65 65 28 29 0a 58 09 09 |ll.to fr|ee().X..|
|00001940| 20 20 20 69 6e 20 6d 61 | 69 6e 2e 63 20 6f 6e 09 | in ma|in.c on.|
|00001950| 6c 69 6e 65 20 35 31 2e | 0a 58 0a 58 09 09 20 20 |line 51.|.X.X.. |
|00001960| 20 54 68 65 20 6d 61 6c | 6c 6f 63 20 63 68 61 69 | The mal|loc chai|
|00001970| 6e 20 65 6c 65 6d 65 6e | 74 20 66 6f 6c 6c 6f 77 |n elemen|t follow|
|00001980| 69 6e 67 20 74 68 65 20 | 73 75 73 70 65 63 74 20 |ing the |suspect |
|00001990| 61 6c 6c 6f 63 61 74 69 | 6f 6e 20 69 73 09 66 72 |allocati|on is.fr|
|000019a0| 6f 6d 3a 0a 58 0a 58 09 | 09 20 20 20 41 20 63 61 |om:.X.X.|. A ca|
|000019b0| 6c 6c 20 74 6f 20 72 65 | 61 6c 6c 6f 63 20 66 6f |ll to re|alloc fo|
|000019c0| 72 20 34 30 39 36 20 62 | 79 74 65 73 20 69 6e 20 |r 4096 b|ytes in |
|000019d0| 66 75 6e 63 2e 63 20 6c | 69 6e 65 20 33 37 36 2e |func.c l|ine 376.|
|000019e0| 0a 58 09 09 20 20 20 54 | 68 69 73 09 77 61 73 20 |.X.. T|his.was |
|000019f0| 74 68 65 09 31 73 74 20 | 63 61 6c 6c 20 74 6f 20 |the.1st |call to |
|00001a00| 72 65 61 6c 6c 6f 63 2e | 0a 58 0a 58 0a 58 0a 58 |realloc.|.X.X.X.X|
|00001a10| 0a 58 0a 58 0a 58 0a 58 | 0a 58 0a 58 20 20 20 20 |.X.X.X.X|.X.X |
|00001a20| 20 50 61 67 65 20 33 09 | 09 09 20 20 20 31 2e 31 | Page 3.|.. 1.1|
|00001a30| 31 0a 58 0a 58 0a 58 0a | 58 0a 58 0a 58 0a 58 20 |1.X.X.X.|X.X.X.X |
|00001a40| 20 20 20 20 44 45 42 55 | 47 5f 4d 41 4c 4c 4f 43 | DEBU|G_MALLOC|
|00001a50| 28 33 29 09 09 20 20 20 | 28 56 54 49 29 09 20 20 |(3).. |(VTI). |
|00001a60| 20 20 20 20 20 44 45 42 | 55 47 5f 4d 41 4c 4c 4f | DEB|UG_MALLO|
|00001a70| 43 28 33 29 0a 58 0a 58 | 0a 58 0a 58 09 20 20 4f |C(3).X.X|.X.X. O|
|00001a80| 6e 63 65 20 74 68 65 20 | 65 72 72 6f 72 20 6d 65 |nce the |error me|
|00001a90| 73 73 61 67 65 20 68 61 | 73 20 62 65 65 6e 20 64 |ssage ha|s been d|
|00001aa0| 69 73 70 6c 61 79 65 64 | 2c 20 74 68 65 20 73 6f |isplayed|, the so|
|00001ab0| 66 74 77 61 72 65 20 77 | 69 6c 6c 0a 58 09 20 20 |ftware w|ill.X. |
|00001ac0| 74 68 65 6e 20 64 65 74 | 65 72 6d 69 6e 65 20 68 |then det|ermine h|
|00001ad0| 6f 77 20 74 6f 09 68 61 | 6e 64 6c 65 20 74 68 65 |ow to.ha|ndle the|
|00001ae0| 20 65 72 72 6f 72 2e 20 | 20 54 68 69 73 09 68 61 | error. | This.ha|
|00001af0| 6e 64 6c 69 6e 67 20 77 | 69 6c 6c 0a 58 09 20 20 |ndling w|ill.X. |
|00001b00| 62 65 20 62 61 73 65 64 | 20 75 70 6f 6e 09 74 68 |be based| upon.th|
|00001b10| 65 20 74 79 70 65 20 6f | 66 20 65 72 72 6f 72 20 |e type o|f error |
|00001b20| 6c 65 76 65 6c 09 28 77 | 61 72 6e 69 6e 67 20 6f |level.(w|arning o|
|00001b30| 72 20 66 61 74 61 6c 29 | 20 61 6e 64 0a 58 09 20 |r fatal)| and.X. |
|00001b40| 20 74 68 65 20 65 72 72 | 6f 72 20 68 61 6e 64 6c | the err|or handl|
|00001b50| 69 6e 67 20 69 6e 09 65 | 66 66 65 63 74 20 66 6f |ing in.e|ffect fo|
|00001b60| 72 20 74 68 61 74 09 65 | 72 72 6f 72 20 6c 65 76 |r that.e|rror lev|
|00001b70| 65 6c 20 28 61 73 0a 58 | 09 20 20 73 70 65 63 69 |el (as.X|. speci|
|00001b80| 66 69 65 64 20 62 79 20 | 63 61 6c 6c 73 20 74 6f |fied by |calls to|
|00001b90| 09 6d 61 6c 6c 6f 70 74 | 09 6f 72 20 76 69 61 20 |.mallopt|.or via |
|00001ba0| 65 6e 76 69 72 6f 6e 6d | 65 6e 74 20 76 61 72 69 |environm|ent vari|
|00001bb0| 61 62 6c 65 73 29 2e 0a | 58 09 20 20 54 68 65 20 |ables)..|X. The |
|00001bc0| 63 6f 64 69 6e 67 20 66 | 6f 72 20 74 68 65 20 65 |coding f|or the e|
|00001bd0| 72 72 6f 72 20 68 61 6e | 64 6c 69 6e 67 20 69 73 |rror han|dling is|
|00001be0| 20 61 73 20 66 6f 6c 6c | 6f 77 73 3a 0a 58 0a 58 | as foll|ows:.X.X|
|00001bf0| 09 20 20 20 20 30 09 63 | 6f 6e 74 69 6e 75 65 20 |. 0.c|ontinue |
|00001c00| 6f 70 65 72 61 74 69 6f | 6e 73 0a 58 09 20 20 20 |operatio|ns.X. |
|00001c10| 20 31 09 64 72 6f 70 20 | 63 6f 72 65 20 61 6e 64 | 1.drop |core and|
|00001c20| 20 65 78 69 74 0a 58 09 | 20 20 20 20 32 09 6a 75 | exit.X.| 2.ju|
|00001c30| 73 74 20 65 78 69 74 0a | 58 09 20 20 20 20 33 09 |st exit.|X. 3.|
|00001c40| 64 72 6f 70 20 63 6f 72 | 65 2c 20 62 75 74 20 63 |drop cor|e, but c|
|00001c50| 6f 6e 74 69 6e 75 65 09 | 65 78 65 63 75 74 69 6e |ontinue.|executin|
|00001c60| 67 2e 20 20 43 6f 72 65 | 20 66 69 6c 65 73 20 77 |g. Core| files w|
|00001c70| 69 6c 6c 20 62 65 0a 58 | 09 09 70 6c 61 63 65 64 |ill be.X|..placed|
|00001c80| 20 69 6e 74 6f 20 63 6f | 72 65 2e 5b 50 49 44 5d | into co|re.[PID]|
|00001c90| 2e 5b 63 6f 75 6e 74 65 | 72 5d 20 69 2e 65 3a 20 |.[counte|r] i.e: |
|00001ca0| 63 6f 72 65 2e 30 30 31 | 32 33 2e 30 30 31 0a 58 |core.001|23.001.X|
|00001cb0| 09 20 20 31 32 38 09 64 | 75 6d 70 20 6d 61 6c 6c |. 128.d|ump mall|
|00001cc0| 6f 63 20 63 68 61 69 6e | 20 61 6e 64 20 63 6f 6e |oc chain| and con|
|00001cd0| 74 69 6e 75 65 0a 58 09 | 20 20 31 32 39 09 64 75 |tinue.X.| 129.du|
|00001ce0| 6d 70 20 6d 61 6c 6c 6f | 63 20 63 68 61 69 6e 2c |mp mallo|c chain,|
|00001cf0| 20 64 75 6d 70 09 63 6f | 72 65 2c 20 61 6e 64 20 | dump.co|re, and |
|00001d00| 65 78 69 74 0a 58 09 20 | 20 31 33 30 09 64 75 6d |exit.X. | 130.dum|
|00001d10| 70 20 6d 61 6c 6c 6f 63 | 20 63 68 61 69 6e 2c 20 |p malloc| chain, |
|00001d20| 65 78 69 74 0a 58 09 20 | 20 31 33 31 09 64 75 6d |exit.X. | 131.dum|
|00001d30| 70 20 6d 61 6c 6c 6f 63 | 20 63 68 61 69 6e 2c 20 |p malloc| chain, |
|00001d40| 64 75 6d 70 09 63 6f 72 | 65 2c 20 63 6f 6e 74 69 |dump.cor|e, conti|
|00001d50| 6e 75 65 20 70 72 6f 63 | 65 73 73 69 6e 67 0a 58 |nue proc|essing.X|
|00001d60| 0a 58 09 20 20 64 62 6d | 61 6c 6c 6f 70 74 28 29 |.X. dbm|allopt()|
|00001d70| 20 69 73 20 75 73 65 64 | 20 74 6f 20 73 65 74 20 | is used| to set |
|00001d80| 74 68 65 20 6d 61 6c 6c | 6f 63 09 64 65 62 75 67 |the mall|oc.debug|
|00001d90| 67 69 6e 67 20 6f 70 74 | 69 6f 6e 73 2e 20 54 68 |ging opt|ions. Th|
|00001da0| 65 0a 58 09 20 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |e.X. fo|llowing |
|00001db0| 6f 70 74 69 6f 6e 73 20 | 63 61 6e 09 62 65 20 73 |options |can.be s|
|00001dc0| 65 74 3a 0a 58 0a 58 09 | 20 20 4d 41 4c 4c 4f 43 |et:.X.X.| MALLOC|
|00001dd0| 5f 57 41 52 4e 09 20 20 | 20 20 20 20 73 65 74 20 |_WARN. | set |
|00001de0| 74 68 65 20 65 72 72 6f | 72 20 68 61 6e 64 6c 69 |the erro|r handli|
|00001df0| 6e 67 20 66 6f 72 20 77 | 61 72 6e 69 6e 67 20 6c |ng for w|arning l|
|00001e00| 65 76 65 6c 0a 58 09 09 | 09 20 20 20 20 20 20 65 |evel.X..|. e|
|00001e10| 72 72 6f 72 73 2e 20 20 | 76 61 6c 2e 69 20 69 73 |rrors. |val.i is|
|00001e20| 09 61 6e 20 69 6e 74 65 | 67 65 72 20 74 68 61 74 |.an inte|ger that|
|00001e30| 09 63 61 6e 0a 58 09 09 | 09 20 20 20 20 20 20 63 |.can.X..|. c|
|00001e40| 6f 6e 74 61 69 6e 20 61 | 6e 79 20 6f 6e 65 20 6f |ontain a|ny one o|
|00001e50| 66 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |f the fo|llowing |
|00001e60| 76 61 6c 75 65 73 3a 0a | 58 0a 58 09 09 09 20 20 |values:.|X.X... |
|00001e70| 20 20 20 20 4d 5f 48 41 | 4e 44 4c 45 5f 49 47 4e | M_HA|NDLE_IGN|
|00001e80| 4f 52 45 09 20 20 69 67 | 6e 6f 72 65 20 65 72 72 |ORE. ig|nore err|
|00001e90| 6f 72 20 28 6a 75 73 74 | 0a 58 09 09 09 09 09 09 |or (just|.X......|
|00001ea0| 20 20 64 69 73 70 6c 61 | 79 20 77 61 72 6e 69 6e | displa|y warnin|
|00001eb0| 67 0a 58 09 09 09 09 09 | 09 20 20 6d 65 73 73 61 |g.X.....|. messa|
|00001ec0| 67 65 20 61 6e 64 20 63 | 6f 6e 74 69 6e 75 65 0a |ge and c|ontinue.|
|00001ed0| 58 09 09 09 09 09 09 20 | 20 70 72 6f 63 65 73 73 |X...... | process|
|00001ee0| 69 6e 67 29 0a 58 09 09 | 09 20 20 20 20 20 20 4d |ing).X..|. M|
|00001ef0| 5f 48 41 4e 44 4c 45 5f | 41 42 4f 52 54 09 20 20 |_HANDLE_|ABORT. |
|00001f00| 64 72 6f 70 20 63 6f 72 | 65 20 61 6e 64 09 65 78 |drop cor|e and.ex|
|00001f10| 69 74 0a 58 09 09 09 20 | 20 20 20 20 20 4d 5f 48 |it.X... | M_H|
|00001f20| 41 4e 44 4c 45 5f 45 58 | 49 54 09 20 20 6a 75 73 |ANDLE_EX|IT. jus|
|00001f30| 74 20 65 78 69 74 20 28 | 6e 6f 09 63 6f 72 65 0a |t exit (|no.core.|
|00001f40| 58 09 09 09 09 09 09 20 | 20 64 72 6f 70 29 0a 58 |X...... | drop).X|
|00001f50| 09 09 09 20 20 20 20 20 | 20 4d 5f 48 41 4e 44 4c |... | M_HANDL|
|00001f60| 45 5f 43 4f 52 45 09 20 | 20 64 72 6f 70 20 63 6f |E_CORE. | drop co|
|00001f70| 72 65 2c 20 62 75 74 20 | 6b 65 65 70 0a 58 09 09 |re, but |keep.X..|
|00001f80| 09 09 09 09 20 20 6f 6e | 20 67 6f 69 6e 67 0a 58 |.... on| going.X|
|00001f90| 0a 58 09 09 09 20 20 20 | 20 20 20 49 6e 20 61 64 |.X... | In ad|
|00001fa0| 64 69 74 69 6f 6e 2c 20 | 4d 5f 48 41 4e 44 4c 45 |dition, |M_HANDLE|
|00001fb0| 5f 44 55 4d 50 20 6d 61 | 79 20 62 65 09 6f 72 27 |_DUMP ma|y be.or'|
|00001fc0| 64 0a 58 09 09 09 20 20 | 20 20 20 20 69 6e 20 74 |d.X... | in t|
|00001fd0| 6f 20 63 61 75 73 65 20 | 61 20 64 75 6d 70 20 6f |o cause |a dump o|
|00001fe0| 66 20 74 68 65 09 63 75 | 72 72 65 6e 74 09 6d 61 |f the.cu|rrent.ma|
|00001ff0| 6c 6c 6f 63 0a 58 09 09 | 09 20 20 20 20 20 20 63 |lloc.X..|. c|
|00002000| 68 61 69 6e 2e 0a 58 0a | 58 09 09 09 20 20 20 20 |hain..X.|X... |
|00002010| 20 20 54 68 65 20 64 65 | 66 61 75 6c 74 20 61 63 | The de|fault ac|
|00002020| 74 69 6f 6e 20 66 6f 72 | 20 4d 41 4c 4c 4f 43 5f |tion for| MALLOC_|
|00002030| 57 41 52 4e 20 69 73 0a | 58 09 09 09 20 20 20 20 |WARN is.|X... |
|00002040| 20 20 4d 5f 48 41 4e 44 | 4c 45 5f 49 47 4e 4f 52 | M_HAND|LE_IGNOR|
|00002050| 45 2e 0a 58 0a 58 09 20 | 20 4d 41 4c 4c 4f 43 5f |E..X.X. | MALLOC_|
|00002060| 46 41 54 41 4c 09 20 20 | 20 20 20 20 73 65 74 20 |FATAL. | set |
|00002070| 74 68 65 20 65 72 72 6f | 72 20 68 61 6e 64 6c 69 |the erro|r handli|
|00002080| 6e 67 20 66 6f 72 20 66 | 61 74 61 6c 20 6c 65 76 |ng for f|atal lev|
|00002090| 65 6c 0a 58 09 09 09 20 | 20 20 20 20 20 65 72 72 |el.X... | err|
|000020a0| 6f 72 73 2e 20 20 76 61 | 6c 2e 69 20 69 73 09 65 |ors. va|l.i is.e|
|000020b0| 71 75 69 76 61 6c 65 6e | 74 20 74 6f 20 76 61 6c |quivalen|t to val|
|000020c0| 2e 69 0a 58 09 09 09 20 | 20 20 20 20 20 66 6f 72 |.i.X... | for|
|000020d0| 20 4d 41 4c 4c 4f 43 5f | 57 41 52 4e 2e 0a 58 0a | MALLOC_|WARN..X.|
|000020e0| 58 09 09 09 20 20 20 20 | 20 20 54 68 65 20 64 65 |X... | The de|
|000020f0| 66 61 75 6c 74 20 61 63 | 74 69 6f 6e 20 66 6f 72 |fault ac|tion for|
|00002100| 20 4d 41 4c 4c 4f 43 5f | 46 41 54 41 4c 20 69 73 | MALLOC_|FATAL is|
|00002110| 0a 58 09 09 09 20 20 20 | 20 20 20 4d 5f 48 41 4e |.X... | M_HAN|
|00002120| 44 4c 45 5f 41 42 4f 52 | 54 2e 0a 58 0a 58 09 20 |DLE_ABOR|T..X.X. |
|00002130| 20 4d 41 4c 4c 4f 43 5f | 45 52 52 46 49 4c 45 20 | MALLOC_|ERRFILE |
|00002140| 20 20 20 20 20 73 65 74 | 20 74 68 65 20 64 65 73 | set| the des|
|00002150| 74 69 6e 61 74 69 6f 6e | 20 66 6f 72 20 6d 61 6c |tination| for mal|
|00002160| 6c 6f 63 20 65 72 72 6f | 72 0a 58 09 09 09 20 20 |loc erro|r.X... |
|00002170| 20 20 20 20 6d 65 73 73 | 61 67 65 73 2e 09 20 76 | mess|ages.. v|
|00002180| 61 6c 2e 73 74 72 20 69 | 73 20 61 20 70 6f 69 6e |al.str i|s a poin|
|00002190| 74 65 72 20 74 6f 20 61 | 0a 58 09 09 09 20 20 20 |ter to a|.X... |
|000021a0| 20 20 20 63 68 61 72 61 | 63 74 65 72 09 73 74 72 | chara|cter.str|
|000021b0| 69 6e 67 20 63 6f 6e 74 | 61 69 6e 69 6e 67 20 74 |ing cont|aining t|
|000021c0| 68 65 20 6e 61 6d 65 20 | 6f 66 0a 58 09 09 09 20 |he name |of.X... |
|000021d0| 20 20 20 20 20 74 68 65 | 20 66 69 6c 65 20 74 6f | the| file to|
|000021e0| 20 62 65 20 75 73 65 64 | 20 66 6f 72 20 65 72 72 | be used| for err|
|000021f0| 6f 72 20 6d 65 73 73 61 | 67 65 73 2e 0a 58 0a 58 |or messa|ges..X.X|
|00002200| 0a 58 0a 58 20 20 20 20 | 20 50 61 67 65 20 34 09 |.X.X | Page 4.|
|00002210| 09 09 20 20 20 31 2e 31 | 31 0a 58 0a 58 0a 58 0a |.. 1.1|1.X.X.X.|
|00002220| 58 0a 58 0a 58 0a 58 20 | 20 20 20 20 44 45 42 55 |X.X.X.X | DEBU|
|00002230| 47 5f 4d 41 4c 4c 4f 43 | 28 33 29 09 09 20 20 20 |G_MALLOC|(3).. |
|00002240| 28 56 54 49 29 09 20 20 | 20 20 20 20 20 44 45 42 |(VTI). | DEB|
|00002250| 55 47 5f 4d 41 4c 4c 4f | 43 28 33 29 0a 58 0a 58 |UG_MALLO|C(3).X.X|
|00002260| 0a 58 0a 58 09 09 09 20 | 20 20 20 20 20 4e 6f 74 |.X.X... | Not|
|00002270| 65 20 74 68 61 74 09 65 | 72 72 6f 72 20 6d 65 73 |e that.e|rror mes|
|00002280| 73 61 67 65 73 20 61 72 | 65 20 41 50 50 45 4e 44 |sages ar|e APPEND|
|00002290| 45 44 20 74 6f 0a 58 09 | 09 09 20 20 20 20 20 20 |ED to.X.|.. |
|000022a0| 74 68 69 73 20 66 69 6c | 65 2c 20 73 6f 20 65 78 |this fil|e, so ex|
|000022b0| 69 73 74 69 6e 67 20 65 | 72 72 6f 72 20 6d 65 73 |isting e|rror mes|
|000022c0| 73 61 67 65 73 0a 58 09 | 09 09 20 20 20 20 20 20 |sages.X.|.. |
|000022d0| 77 69 6c 6c 20 6e 6f 74 | 20 62 65 20 72 65 6d 6f |will not| be remo|
|000022e0| 76 65 64 2e 0a 58 0a 58 | 09 09 09 20 20 20 20 20 |ved..X.X|... |
|000022f0| 20 49 66 20 4d 41 4c 4c | 4f 43 5f 45 52 52 46 49 | If MALL|OC_ERRFI|
|00002300| 4c 45 09 69 73 20 6e 6f | 74 20 73 65 74 2c 20 61 |LE.is no|t set, a|
|00002310| 6c 6c 09 65 72 72 6f 72 | 0a 58 09 09 09 20 20 20 |ll.error|.X... |
|00002320| 20 20 20 6d 65 73 73 61 | 67 65 73 20 77 69 6c 6c | messa|ges will|
|00002330| 20 62 65 20 73 65 6e 74 | 20 74 6f 20 73 74 64 65 | be sent| to stde|
|00002340| 72 72 2e 0a 58 0a 58 09 | 20 20 4d 41 4c 4c 4f 43 |rr..X.X.| MALLOC|
|00002350| 5f 43 4b 43 48 41 49 4e | 20 20 20 20 20 20 73 65 |_CKCHAIN| se|
|00002360| 74 20 74 68 65 20 6d 61 | 6c 6c 6f 63 20 63 68 61 |t the ma|lloc cha|
|00002370| 69 6e 20 63 68 65 63 6b | 69 6e 67 20 66 6c 61 67 |in check|ing flag|
|00002380| 2e 20 20 49 66 0a 58 09 | 09 09 20 20 20 20 20 20 |. If.X.|.. |
|00002390| 76 61 6c 2e 69 20 69 73 | 20 6e 6f 6e 2d 7a 65 72 |val.i is| non-zer|
|000023a0| 6f 2c 20 63 68 61 69 6e | 20 63 68 65 63 6b 69 6e |o, chain| checkin|
|000023b0| 67 09 61 74 0a 58 09 09 | 09 20 20 20 20 20 20 65 |g.at.X..|. e|
|000023c0| 76 65 72 79 20 63 61 6c | 6c 20 74 6f 20 6d 61 6c |very cal|l to mal|
|000023d0| 6c 6f 63 20 69 73 20 74 | 75 72 6e 65 64 20 6f 6e |loc is t|urned on|
|000023e0| 2e 20 54 68 65 0a 58 09 | 09 09 20 20 20 20 20 20 |. The.X.|.. |
|000023f0| 64 65 66 61 75 6c 74 20 | 62 65 68 61 76 69 6f 72 |default |behavior|
|00002400| 20 69 73 20 74 6f 20 6e | 6f 74 20 63 68 65 63 6b | is to n|ot check|
|00002410| 20 74 68 65 0a 58 09 09 | 09 20 20 20 20 20 20 63 | the.X..|. c|
|00002420| 68 61 69 6e 20 61 74 20 | 65 61 63 68 20 63 61 6c |hain at |each cal|
|00002430| 6c 20 74 6f 20 6d 61 6c | 6c 6f 63 20 62 65 63 61 |l to mal|loc beca|
|00002440| 75 73 65 20 6f 66 0a 58 | 09 09 09 20 20 20 20 20 |use of.X|... |
|00002450| 20 70 65 72 66 6f 72 6d | 61 6e 63 65 20 69 73 73 | perform|ance iss|
|00002460| 75 65 73 20 28 74 68 65 | 20 6c 69 62 72 61 72 79 |ues (the| library|
|00002470| 20 69 73 0a 58 09 09 09 | 20 20 20 20 20 20 63 6f | is.X...| co|
|00002480| 6e 73 69 64 65 72 61 62 | 6c 79 20 73 6c 6f 77 65 |nsiderab|ly slowe|
|00002490| 72 20 77 68 65 6e 20 74 | 68 69 73 20 66 75 6e 63 |r when t|his func|
|000024a0| 74 69 6f 6e 0a 58 09 09 | 09 20 20 20 20 20 20 69 |tion.X..|. i|
|000024b0| 73 20 65 6e 61 62 6c 65 | 64 29 2e 0a 58 0a 58 09 |s enable|d)..X.X.|
|000024c0| 20 20 4d 41 4c 4c 4f 43 | 5f 46 52 45 45 4d 41 52 | MALLOC|_FREEMAR|
|000024d0| 4b 20 20 20 20 20 73 65 | 74 73 20 74 68 65 20 62 |K se|ts the b|
|000024e0| 65 68 61 76 69 6f 72 09 | 6f 66 20 66 72 65 65 69 |ehavior.|of freei|
|000024f0| 6e 67 20 6f 66 20 6d 61 | 72 6b 65 64 0a 58 09 09 |ng of ma|rked.X..|
|00002500| 09 20 20 20 20 20 20 61 | 72 65 61 73 2e 20 20 42 |. a|reas. B|
|00002510| 79 20 64 65 66 61 75 6c | 74 2c 20 61 20 66 72 65 |y defaul|t, a fre|
|00002520| 65 20 6f 66 20 61 20 6d | 61 72 6b 65 64 0a 58 09 |e of a m|arked.X.|
|00002530| 09 09 20 20 20 20 20 20 | 73 65 67 6d 65 6e 74 20 |.. |segment |
|00002540| 67 65 6e 65 72 61 74 65 | 73 09 61 20 77 61 72 6e |generate|s.a warn|
|00002550| 69 6e 67 2e 20 20 49 66 | 20 76 61 6c 2e 69 0a 58 |ing. If| val.i.X|
|00002560| 09 09 09 20 20 20 20 20 | 20 69 73 20 7a 65 72 6f |... | is zero|
|00002570| 2c 20 77 61 72 6e 69 6e | 67 73 09 77 69 6c 6c 20 |, warnin|gs.will |
|00002580| 6e 6f 74 20 62 65 20 67 | 65 6e 65 72 61 74 65 64 |not be g|enerated|
|00002590| 2e 0a 58 0a 58 09 20 20 | 4d 41 4c 4c 4f 43 5f 46 |..X.X. |MALLOC_F|
|000025a0| 49 4c 4c 41 52 45 41 20 | 20 20 20 20 73 65 74 20 |ILLAREA | set |
|000025b0| 74 68 65 20 6d 61 6c 6c | 6f 63 20 66 69 6c 6c 20 |the mall|oc fill |
|000025c0| 61 72 65 61 20 66 6c 61 | 67 2e 20 20 76 61 6c 2e |area fla|g. val.|
|000025d0| 69 0a 58 09 09 09 20 20 | 20 20 20 20 73 70 65 63 |i.X... | spec|
|000025e0| 69 66 69 65 73 09 74 68 | 65 20 6d 61 6c 6c 6f 63 |ifies.th|e malloc|
|000025f0| 20 66 69 6c 6c 69 6e 67 | 20 6d 6f 64 65 09 74 6f | filling| mode.to|
|00002600| 20 62 65 0a 58 09 09 09 | 20 20 20 20 20 20 75 73 | be.X...| us|
|00002610| 65 64 2e 20 20 20 54 68 | 65 72 65 20 61 72 65 09 |ed. Th|ere are.|
|00002620| 66 6f 75 72 20 6d 6f 64 | 65 73 3a 20 30 2c 20 31 |four mod|es: 0, 1|
|00002630| 2c 20 32 0a 58 09 09 09 | 20 20 20 20 20 20 61 6e |, 2.X...| an|
|00002640| 64 20 33 2e 20 20 4d 6f | 64 65 20 30 20 64 69 73 |d 3. Mo|de 0 dis|
|00002650| 61 62 6c 65 73 20 61 6c | 6c 20 66 69 6c 6c 69 6e |ables al|l fillin|
|00002660| 67 20 61 6e 64 0a 58 09 | 09 09 20 20 20 20 20 20 |g and.X.|.. |
|00002670| 63 68 65 63 6b 69 6e 67 | 20 6f 66 20 66 69 6c 6c |checking| of fill|
|00002680| 65 64 20 61 72 65 61 73 | 20 28 74 68 65 72 65 62 |ed areas| (thereb|
|00002690| 79 0a 58 09 09 09 20 20 | 20 20 20 20 72 65 64 75 |y.X... | redu|
|000026a0| 63 69 6e 67 20 74 68 65 | 20 65 66 66 65 63 74 69 |cing the| effecti|
|000026b0| 76 65 6e 65 73 73 20 6f | 66 20 74 68 65 0a 58 09 |veness o|f the.X.|
|000026c0| 09 09 20 20 20 20 20 20 | 6c 69 62 72 61 72 79 29 |.. |library)|
|000026d0| 2e 09 20 4d 6f 64 65 20 | 31 09 65 6e 61 62 6c 65 |.. Mode |1.enable|
|000026e0| 73 09 74 68 65 20 66 69 | 6c 6c 69 6e 67 20 6f 66 |s.the fi|lling of|
|000026f0| 0a 58 09 09 09 20 20 20 | 20 20 20 62 6f 75 6e 64 |.X... | bound|
|00002700| 61 72 79 20 61 72 65 61 | 73 20 62 65 66 6f 72 65 |ary area|s before|
|00002710| 20 61 6e 64 09 61 66 74 | 65 72 20 74 68 65 0a 58 | and.aft|er the.X|
|00002720| 09 09 09 20 20 20 20 20 | 20 61 6c 6c 6f 63 61 74 |... | allocat|
|00002730| 69 6f 6e 20 61 72 65 61 | 73 20 77 68 69 63 68 20 |ion area|s which |
|00002740| 61 72 65 20 75 73 65 64 | 20 74 6f 20 63 68 65 63 |are used| to chec|
|00002750| 6b 0a 58 09 09 09 20 20 | 20 20 20 20 66 6f 72 20 |k.X... | for |
|00002760| 77 72 69 74 69 6e 67 20 | 62 65 66 6f 72 65 20 6f |writing |before o|
|00002770| 72 20 61 66 74 65 72 20 | 74 68 65 20 70 6f 69 6e |r after |the poin|
|00002780| 74 65 72 2e 0a 58 09 09 | 09 20 20 20 20 20 20 4d |ter..X..|. M|
|00002790| 6f 64 65 20 32 20 69 6e | 63 6c 75 64 65 73 20 6d |ode 2 in|cludes m|
|000027a0| 6f 64 65 20 31 20 61 6e | 64 20 61 64 64 73 20 74 |ode 1 an|d adds t|
|000027b0| 68 65 0a 58 09 09 09 20 | 20 20 20 20 20 66 69 6c |he.X... | fil|
|000027c0| 6c 69 6e 67 20 6f 66 20 | 6d 61 6c 6c 6f 63 65 64 |ling of |malloced|
|000027d0| 20 72 65 67 69 6f 6e 73 | 20 77 69 74 68 20 61 0a | regions| with a.|
|000027e0| 58 09 09 09 20 20 20 20 | 20 20 73 70 65 63 69 66 |X... | specif|
|000027f0| 69 65 64 09 66 69 6c 6c | 20 70 61 74 74 65 72 6e |ied.fill| pattern|
|00002800| 20 73 6f 09 74 68 61 74 | 20 61 20 70 72 6f 67 72 | so.that| a progr|
|00002810| 61 6d 0a 58 09 09 09 20 | 20 20 20 20 20 64 6f 65 |am.X... | doe|
|00002820| 73 20 6e 6f 74 20 64 65 | 70 65 6e 64 20 75 70 6f |s not de|pend upo|
|00002830| 6e 20 6d 61 6c 6c 6f 63 | 65 64 20 72 65 67 69 6f |n malloc|ed regio|
|00002840| 6e 73 20 74 6f 0a 58 09 | 09 09 20 20 20 20 20 20 |ns to.X.|.. |
|00002850| 62 65 20 66 69 6c 6c 65 | 64 09 77 69 74 68 20 7a |be fille|d.with z|
|00002860| 65 72 6f 73 2e 20 20 4d | 6f 64 65 20 33 20 69 6e |eros. M|ode 3 in|
|00002870| 63 6c 75 64 65 73 0a 58 | 09 09 09 20 20 20 20 20 |cludes.X|... |
|00002880| 20 61 6c 6c 20 6f 66 20 | 6d 6f 64 65 20 32 20 61 | all of |mode 2 a|
|00002890| 6e 64 09 61 64 64 73 20 | 74 68 65 20 66 69 6c 6c |nd.adds |the fill|
|000028a0| 69 6e 67 20 6f 66 0a 58 | 09 09 09 20 20 20 20 20 |ing of.X|... |
|000028b0| 20 66 72 65 65 27 64 20 | 72 65 67 69 6f 6e 73 20 | free'd |regions |
|000028c0| 73 6f 09 74 68 61 74 20 | 61 6e 09 61 74 74 65 6d |so.that |an.attem|
|000028d0| 70 74 09 74 6f 0a 58 09 | 09 09 20 20 20 20 20 20 |pt.to.X.|.. |
|000028e0| 75 73 65 64 20 61 20 66 | 72 65 65 64 20 64 61 74 |used a f|reed dat|
|000028f0| 61 09 61 72 65 61 20 77 | 69 6c 6c 20 72 65 73 75 |a.area w|ill resu|
|00002900| 6c 74 20 69 6e 20 61 6e | 0a 58 09 09 09 20 20 20 |lt in an|.X... |
|00002910| 20 20 20 65 72 72 6f 72 | 2e 0a 58 0a 58 09 09 09 | error|..X.X...|
|00002920| 20 20 20 20 20 20 41 73 | 20 66 61 72 20 61 73 09 | As| far as.|
|00002930| 70 65 72 66 6f 72 6d 61 | 6e 63 65 20 69 73 20 63 |performa|nce is c|
|00002940| 6f 6e 63 65 72 6e 65 64 | 2c 20 6d 6f 64 65 0a 58 |oncerned|, mode.X|
|00002950| 09 09 09 20 20 20 20 20 | 20 30 09 77 69 6c 6c 20 |... | 0.will |
|00002960| 62 65 09 74 68 65 20 66 | 61 73 74 65 73 74 20 6d |be.the f|astest m|
|00002970| 6f 64 65 2c 20 77 68 69 | 6c 65 0a 58 09 09 09 20 |ode, whi|le.X... |
|00002980| 20 20 20 20 20 28 73 6f | 6d 65 77 68 61 74 09 75 | (so|mewhat.u|
|00002990| 6e 65 78 70 65 63 74 65 | 64 6c 79 29 20 6d 6f 64 |nexpecte|dly) mod|
|000029a0| 65 20 33 20 69 73 09 74 | 68 65 0a 58 09 09 09 20 |e 3 is.t|he.X... |
|000029b0| 20 20 20 20 20 6e 65 78 | 74 20 22 66 61 73 74 65 | nex|t "faste|
|000029c0| 73 74 22 20 6d 6f 64 65 | 20 77 69 74 68 20 6d 6f |st" mode| with mo|
|000029d0| 64 65 20 31 20 62 72 69 | 6e 67 20 75 70 0a 58 09 |de 1 bri|ng up.X.|
|000029e0| 09 09 20 20 20 20 20 20 | 74 68 65 20 74 61 69 6c |.. |the tail|
|000029f0| 20 65 6e 64 2e 0a 58 0a | 58 09 09 09 20 20 20 20 | end..X.|X... |
|00002a00| 20 20 54 68 65 20 64 65 | 66 61 75 6c 74 20 62 65 | The de|fault be|
|00002a10| 68 61 76 69 6f 72 20 66 | 6f 72 20 4d 41 4c 4c 4f |havior f|or MALLO|
|00002a20| 43 5f 46 49 4c 4c 41 52 | 45 41 0a 58 09 09 09 20 |C_FILLAR|EA.X... |
|00002a30| 20 20 20 20 20 69 73 20 | 6d 6f 64 65 20 33 2e 0a | is |mode 3..|
|00002a40| 58 0a 58 09 20 20 4d 41 | 4c 4c 4f 43 5f 4c 4f 57 |X.X. MA|LLOC_LOW|
|00002a50| 46 52 41 47 20 20 20 20 | 20 20 73 65 74 20 74 68 |FRAG | set th|
|00002a60| 65 20 6d 61 6c 6c 6f 63 | 20 61 6c 6c 6f 63 61 74 |e malloc| allocat|
|00002a70| 69 6f 6e 09 66 72 61 67 | 6d 65 6e 74 61 74 69 6f |ion.frag|mentatio|
|00002a80| 6e 0a 58 09 09 09 20 20 | 20 20 20 20 68 61 6e 64 |n.X... | hand|
|00002a90| 6c 69 6e 67 20 6c 65 76 | 65 6c 2e 20 20 42 79 20 |ling lev|el. By |
|00002aa0| 64 65 66 61 75 6c 74 2c | 20 6d 61 6c 6c 6f 63 20 |default,| malloc |
|00002ab0| 75 73 65 73 0a 58 0a 58 | 0a 58 0a 58 20 20 20 20 |uses.X.X|.X.X |
|00002ac0| 20 50 61 67 65 20 35 09 | 09 09 20 20 20 31 2e 31 | Page 5.|.. 1.1|
|00002ad0| 31 0a 58 0a 58 0a 58 0a | 58 0a 58 0a 58 0a 58 20 |1.X.X.X.|X.X.X.X |
|00002ae0| 20 20 20 20 44 45 42 55 | 47 5f 4d 41 4c 4c 4f 43 | DEBU|G_MALLOC|
|00002af0| 28 33 29 09 09 20 20 20 | 28 56 54 49 29 09 20 20 |(3).. |(VTI). |
|00002b00| 20 20 20 20 20 44 45 42 | 55 47 5f 4d 41 4c 4c 4f | DEB|UG_MALLO|
|00002b10| 43 28 33 29 0a 58 0a 58 | 0a 58 0a 58 09 09 09 20 |C(3).X.X|.X.X... |
|00002b20| 20 20 20 20 20 61 09 66 | 69 72 73 74 20 66 69 74 | a.f|irst fit|
|00002b30| 20 61 6c 67 6f 72 69 74 | 68 6d 20 66 6f 72 09 6e | algorit|hm for.n|
|00002b40| 65 77 0a 58 09 09 09 20 | 20 20 20 20 20 61 6c 6c |ew.X... | all|
|00002b50| 6f 63 61 74 69 6f 6e 73 | 2e 20 20 55 6e 64 65 72 |ocations|. Under|
|00002b60| 20 63 65 72 74 61 69 6e | 20 61 6c 6c 6f 63 61 74 | certain| allocat|
|00002b70| 69 6f 6e 0a 58 09 09 09 | 20 20 20 20 20 20 73 63 |ion.X...| sc|
|00002b80| 65 6e 61 72 69 6f 73 2c | 20 74 68 69 73 20 63 61 |enarios,| this ca|
|00002b90| 6e 20 6c 65 61 64 20 74 | 6f 20 73 69 67 6e 69 66 |n lead t|o signif|
|00002ba0| 69 63 61 6e 74 0a 58 09 | 09 09 20 20 20 20 20 20 |icant.X.|.. |
|00002bb0| 6d 65 6d 6f 72 79 20 66 | 72 61 67 6d 65 6e 74 61 |memory f|ragmenta|
|00002bc0| 74 69 6f 6e 20 62 65 63 | 61 75 73 65 20 6f 66 20 |tion bec|ause of |
|00002bd0| 74 68 65 20 66 61 63 74 | 0a 58 09 09 09 20 20 20 |the fact|.X... |
|00002be0| 20 20 20 74 68 61 74 20 | 6c 69 74 74 6c 65 20 61 | that |little a|
|00002bf0| 6c 6c 6f 63 61 74 69 6f | 6e 73 20 63 61 6e 20 62 |llocatio|ns can b|
|00002c00| 72 65 61 6b 09 62 69 67 | 0a 58 09 09 09 20 20 20 |reak.big|.X... |
|00002c10| 20 20 20 62 6c 6f 63 6b | 73 20 75 70 2e 0a 58 0a | block|s up..X.|
|00002c20| 58 09 09 09 20 20 20 20 | 20 20 49 66 20 76 61 6c |X... | If val|
|00002c30| 2e 69 20 69 73 20 6e 6f | 6e 2d 7a 65 72 6f 2c 20 |.i is no|n-zero, |
|00002c40| 6d 61 6c 6c 6f 63 20 75 | 73 65 73 09 61 20 62 65 |malloc u|ses.a be|
|00002c50| 73 74 0a 58 09 09 09 20 | 20 20 20 20 20 66 69 74 |st.X... | fit|
|00002c60| 20 61 6c 67 6f 72 69 74 | 68 6d 20 77 68 69 63 68 | algorit|hm which|
|00002c70| 20 77 69 6c 6c 20 72 65 | 64 75 63 65 0a 58 09 09 | will re|duce.X..|
|00002c80| 09 20 20 20 20 20 20 66 | 72 61 67 6d 65 6e 74 61 |. f|ragmenta|
|00002c90| 74 69 6f 6e 2e 20 20 54 | 68 69 73 20 6d 65 63 68 |tion. T|his mech|
|00002ca0| 61 6e 69 73 6d 2c 20 77 | 68 69 6c 65 0a 58 09 09 |anism, w|hile.X..|
|00002cb0| 09 20 20 20 20 20 20 75 | 73 69 6e 67 20 6c 65 73 |. u|sing les|
|00002cc0| 73 20 6d 65 6d 6f 72 79 | 2c 20 69 73 20 73 6c 6f |s memory|, is slo|
|00002cd0| 77 65 72 20 62 65 63 61 | 75 73 65 20 74 68 65 0a |wer beca|use the.|
|00002ce0| 58 09 09 09 20 20 20 20 | 20 20 65 6e 74 69 72 65 |X... | entire|
|00002cf0| 20 66 72 65 65 20 6c 69 | 73 74 20 69 73 20 63 68 | free li|st is ch|
|00002d00| 65 63 6b 65 64 20 69 6e | 73 74 65 61 64 20 6f 66 |ecked in|stead of|
|00002d10| 0a 58 09 09 09 20 20 20 | 20 20 20 6a 75 73 74 20 |.X... | just |
|00002d20| 63 68 65 63 6b 69 6e 67 | 20 75 6e 74 69 6c 20 77 |checking| until w|
|00002d30| 65 20 66 69 6e 64 20 61 | 20 73 65 67 6d 65 6e 74 |e find a| segment|
|00002d40| 0a 58 09 09 09 20 20 20 | 20 20 20 74 68 61 74 20 |.X... | that |
|00002d50| 69 73 20 61 74 20 6c 65 | 61 73 74 20 62 69 67 20 |is at le|ast big |
|00002d60| 65 6e 6f 75 67 68 2e 20 | 20 4e 6f 72 6d 61 6c 6c |enough. | Normall|
|00002d70| 79 0a 58 09 09 09 20 20 | 20 20 20 20 79 6f 75 20 |y.X... | you |
|00002d80| 77 69 6c 6c 20 6e 6f 74 | 20 6e 65 65 64 09 74 6f |will not| need.to|
|00002d90| 20 73 65 74 20 74 68 69 | 73 20 76 61 72 69 61 62 | set thi|s variab|
|00002da0| 6c 65 2e 0a 58 0a 58 09 | 20 20 4d 41 4c 4c 4f 43 |le..X.X.| MALLOC|
|00002db0| 5f 43 4b 44 41 54 41 09 | 20 20 20 20 20 20 65 6e |_CKDATA.| en|
|00002dc0| 61 62 6c 65 2f 64 69 73 | 61 62 6c 65 20 74 68 65 |able/dis|able the|
|00002dd0| 20 63 68 65 63 6b 69 6e | 67 20 6f 66 20 70 6f 69 | checkin|g of poi|
|00002de0| 6e 74 65 72 73 0a 58 09 | 09 09 20 20 20 20 20 20 |nters.X.|.. |
|00002df0| 70 61 73 73 65 64 20 74 | 6f 09 74 68 65 20 6d 65 |passed t|o.the me|
|00002e00| 6d 6f 72 79 20 28 6d 65 | 6d 2a 2c 62 2a 29 20 61 |mory (me|m*,b*) a|
|00002e10| 6e 64 0a 58 09 09 09 20 | 20 20 20 20 20 73 74 72 |nd.X... | str|
|00002e20| 69 6e 67 20 28 73 74 72 | 2a 29 20 66 75 6e 63 74 |ing (str|*) funct|
|00002e30| 69 6f 6e 73 2e 09 54 68 | 69 73 20 63 61 6e 20 62 |ions..Th|is can b|
|00002e40| 65 0a 58 09 09 09 20 20 | 20 20 20 20 75 73 65 64 |e.X... | used|
|00002e50| 20 74 6f 20 73 74 61 72 | 74 75 70 20 74 68 65 20 | to star|tup the |
|00002e60| 63 6f 64 65 20 77 69 74 | 68 20 63 68 65 63 6b 69 |code wit|h checki|
|00002e70| 6e 67 0a 58 09 09 09 20 | 20 20 20 20 20 64 69 73 |ng.X... | dis|
|00002e80| 61 62 6c 65 64 20 28 77 | 68 65 6e 20 79 6f 75 20 |abled (w|hen you |
|00002e90| 6b 6e 6f 77 20 74 68 65 | 20 73 74 61 72 74 75 70 |know the| startup|
|00002ea0| 20 63 6f 64 65 0a 58 09 | 09 09 20 20 20 20 20 20 | code.X.|.. |
|00002eb0| 69 73 20 66 75 6e 63 74 | 69 6f 6e 69 6e 67 20 63 |is funct|ioning c|
|00002ec0| 6f 72 72 65 63 74 6c 79 | 29 09 61 6e 64 20 74 68 |orrectly|).and th|
|00002ed0| 65 6e 20 74 75 72 6e 0a | 58 09 09 09 20 20 20 20 |en turn.|X... |
|00002ee0| 20 20 69 74 20 6f 6e 20 | 6c 61 74 65 72 20 77 68 | it on |later wh|
|00002ef0| 65 6e 20 79 6f 75 20 67 | 65 74 20 69 6e 74 6f 20 |en you g|et into |
|00002f00| 74 68 65 09 61 72 65 61 | 0a 58 09 09 09 20 20 20 |the.area|.X... |
|00002f10| 20 20 20 6f 66 20 74 68 | 65 20 63 6f 64 65 20 74 | of th|e code t|
|00002f20| 68 61 74 20 69 73 20 69 | 6e 20 71 75 65 73 74 69 |hat is i|n questi|
|00002f30| 6f 6e 2e 0a 58 0a 58 09 | 09 09 20 20 20 20 20 20 |on..X.X.|.. |
|00002f40| 69 66 20 76 61 6c 2e 69 | 20 69 73 20 6e 6f 6e 2d |if val.i| is non-|
|00002f50| 7a 65 72 6f 2c 20 70 6f | 69 6e 74 65 72 20 63 68 |zero, po|inter ch|
|00002f60| 65 63 6b 69 6e 67 0a 58 | 09 09 09 20 20 20 20 20 |ecking.X|... |
|00002f70| 20 69 73 20 65 6e 61 62 | 6c 65 64 20 28 77 68 69 | is enab|led (whi|
|00002f80| 63 68 09 69 73 20 74 68 | 65 20 64 65 66 61 75 6c |ch.is th|e defaul|
|00002f90| 74 20 6d 6f 64 65 29 2e | 0a 58 0a 58 09 20 20 4d |t mode).|.X.X. M|
|00002fa0| 41 4c 4c 4f 43 5f 52 45 | 55 53 45 09 20 20 20 20 |ALLOC_RE|USE. |
|00002fb0| 20 20 65 6e 61 62 6c 65 | 2f 64 69 73 61 62 6c 65 | enable|/disable|
|00002fc0| 20 74 68 65 20 72 65 75 | 73 65 20 6f 66 20 66 72 | the reu|se of fr|
|00002fd0| 65 65 64 0a 58 09 09 09 | 20 20 20 20 20 20 73 65 |eed.X...| se|
|00002fe0| 67 6d 65 6e 74 73 2e 09 | 20 54 68 69 73 20 6f 70 |gments..| This op|
|00002ff0| 74 69 6f 6e 20 63 61 6e | 20 62 65 20 75 73 65 64 |tion can| be used|
|00003000| 20 74 6f 0a 58 09 09 09 | 20 20 20 20 20 20 68 65 | to.X...| he|
|00003010| 6c 70 20 69 64 65 6e 74 | 69 66 79 20 77 68 65 72 |lp ident|ify wher|
|00003020| 65 20 61 20 66 72 65 65 | 64 20 70 6f 69 6e 74 65 |e a free|d pointe|
|00003030| 72 20 69 73 0a 58 09 09 | 09 20 20 20 20 20 20 62 |r is.X..|. b|
|00003040| 65 69 6e 67 20 72 65 2d | 75 73 65 64 2c 20 6f 72 |eing re-|used, or|
|00003050| 09 77 68 65 72 65 20 69 | 74 20 69 73 20 62 65 69 |.where i|t is bei|
|00003060| 6e 67 0a 58 09 09 09 20 | 20 20 20 20 20 66 72 65 |ng.X... | fre|
|00003070| 65 64 20 61 20 73 65 63 | 6f 6e 64 20 74 69 6d 65 |ed a sec|ond time|
|00003080| 2c 20 73 69 6e 63 65 20 | 74 68 65 20 6c 6f 63 61 |, since |the loca|
|00003090| 74 69 6f 6e 0a 58 09 09 | 09 20 20 20 20 20 20 77 |tion.X..|. w|
|000030a0| 68 65 72 65 20 69 74 20 | 77 61 73 20 66 72 65 65 |here it |was free|
|000030b0| 64 20 69 73 20 61 6c 73 | 6f 20 6b 65 70 74 2e 0a |d is als|o kept..|
|000030c0| 58 0a 58 09 09 09 20 20 | 20 20 20 20 49 74 20 73 |X.X... | It s|
|000030d0| 68 6f 75 6c 64 09 62 65 | 20 6e 6f 74 65 64 20 74 |hould.be| noted t|
|000030e0| 68 61 74 20 74 68 65 20 | 6d 65 6d 6f 72 79 0a 58 |hat the |memory.X|
|000030f0| 09 09 09 20 20 20 20 20 | 20 72 65 71 75 69 72 65 |... | require|
|00003100| 6d 65 6e 74 73 20 66 6f | 72 20 61 20 70 72 6f 67 |ments fo|r a prog|
|00003110| 72 61 6d 20 77 69 6c 6c | 0a 58 09 09 09 20 20 20 |ram will|.X... |
|00003120| 20 20 20 74 79 70 69 63 | 61 6c 6c 79 09 69 6e 63 | typic|ally.inc|
|00003130| 72 65 61 73 65 20 73 69 | 67 6e 69 66 69 63 61 6e |rease si|gnifican|
|00003140| 74 6c 79 20 69 66 20 74 | 68 69 73 0a 58 09 09 09 |tly if t|his.X...|
|00003150| 20 20 20 20 20 20 6f 70 | 74 69 6f 6e 20 69 73 09 | op|tion is.|
|00003160| 75 73 65 64 2e 0a 58 0a | 58 09 09 09 20 20 20 20 |used..X.|X... |
|00003170| 20 20 69 66 20 76 61 6c | 2e 69 20 69 73 20 7a 65 | if val|.i is ze|
|00003180| 72 6f 2c 09 66 72 65 65 | 64 20 73 65 67 6d 65 6e |ro,.free|d segmen|
|00003190| 74 73 20 61 72 65 20 6e | 6f 74 0a 58 09 09 09 20 |ts are n|ot.X... |
|000031a0| 20 20 20 20 20 72 65 75 | 73 65 64 20 66 6f 72 20 | reu|sed for |
|000031b0| 73 75 62 73 65 71 75 65 | 6e 74 20 61 6c 6c 6f 63 |subseque|nt alloc|
|000031c0| 61 74 69 6f 6e 73 2e 20 | 20 20 49 66 0a 58 09 09 |ations. | If.X..|
|000031d0| 09 20 20 20 20 20 20 6e | 6f 6e 2d 7a 65 72 6f 2c |. n|on-zero,|
|000031e0| 09 66 72 65 65 64 20 73 | 65 67 6d 65 6e 74 73 20 |.freed s|egments |
|000031f0| 63 61 6e 20 62 65 20 72 | 65 75 73 65 64 2e 0a 58 |can be r|eused..X|
|00003200| 09 09 09 20 20 20 20 20 | 20 49 66 20 66 72 65 65 |... | If free|
|00003210| 64 20 73 65 67 6d 65 6e | 74 73 09 61 72 65 20 6e |d segmen|ts.are n|
|00003220| 6f 74 09 72 65 2d 75 73 | 65 64 2c 20 79 6f 75 0a |ot.re-us|ed, you.|
|00003230| 58 09 09 09 20 20 20 20 | 20 20 6d 69 67 68 74 20 |X... | might |
|00003240| 77 61 6e 74 20 74 6f 20 | 64 69 73 61 62 6c 65 20 |want to |disable |
|00003250| 66 69 6c 6c 69 6e 67 20 | 6f 66 20 66 72 65 65 64 |filling |of freed|
|00003260| 0a 58 09 09 09 20 20 20 | 20 20 20 73 65 67 6d 65 |.X... | segme|
|00003270| 6e 74 73 20 28 73 65 65 | 20 74 68 65 09 4d 41 4c |nts (see| the.MAL|
|00003280| 4c 4f 43 5f 46 49 4c 4c | 41 52 45 41 0a 58 09 09 |LOC_FILL|AREA.X..|
|00003290| 09 20 20 20 20 20 20 64 | 69 73 63 75 73 73 69 6f |. d|iscussio|
|000032a0| 6e 73 29 20 73 6f 20 74 | 68 61 74 20 79 6f 75 20 |ns) so t|hat you |
|000032b0| 63 61 6e 20 73 65 65 20 | 74 68 65 0a 58 09 09 09 |can see |the.X...|
|000032c0| 20 20 20 20 20 20 64 61 | 74 61 20 69 6e 20 74 68 | da|ta in th|
|000032d0| 65 20 73 65 67 6d 65 6e | 74 20 2d 20 74 68 69 73 |e segmen|t - this|
|000032e0| 20 77 6f 75 6c 64 20 62 | 65 20 66 69 6c 6c 0a 58 | would b|e fill.X|
|000032f0| 09 09 09 20 20 20 20 20 | 20 6d 6f 64 65 20 32 20 |... | mode 2 |
|00003300| 6f 72 09 62 65 6c 6f 77 | 2e 0a 58 0a 58 0a 58 0a |or.below|..X.X.X.|
|00003310| 58 0a 58 0a 58 0a 58 20 | 20 20 20 20 50 61 67 65 |X.X.X.X | Page|
|00003320| 20 36 09 09 09 20 20 20 | 31 2e 31 31 0a 58 0a 58 | 6... |1.11.X.X|
|00003330| 0a 58 0a 58 0a 58 0a 58 | 0a 58 20 20 20 20 20 44 |.X.X.X.X|.X D|
|00003340| 45 42 55 47 5f 4d 41 4c | 4c 4f 43 28 33 29 09 09 |EBUG_MAL|LOC(3)..|
|00003350| 20 20 20 28 56 54 49 29 | 09 20 20 20 20 20 20 20 | (VTI)|. |
|00003360| 44 45 42 55 47 5f 4d 41 | 4c 4c 4f 43 28 33 29 0a |DEBUG_MA|LLOC(3).|
|00003370| 58 0a 58 0a 58 0a 58 09 | 20 20 46 6f 72 20 65 78 |X.X.X.X.| For ex|
|00003380| 61 6d 70 6c 65 2c 20 74 | 6f 20 73 65 74 20 75 70 |ample, t|o set up|
|00003390| 20 74 68 65 20 73 65 73 | 73 69 6f 6e 20 74 6f 09 | the ses|sion to.|
|000033a0| 67 65 6e 65 72 61 74 65 | 20 61 20 63 6f 72 65 09 |generate| a core.|
|000033b0| 66 69 6c 65 0a 58 09 20 | 20 66 6f 72 20 65 76 65 |file.X. | for eve|
|000033c0| 72 79 20 6d 61 6c 6c 6f | 63 20 77 61 72 6e 69 6e |ry mallo|c warnin|
|000033d0| 67 2c 20 74 6f 20 64 72 | 6f 70 20 63 6f 72 65 20 |g, to dr|op core |
|000033e0| 61 6e 64 20 65 78 69 74 | 20 6f 6e 20 61 20 6d 61 |and exit| on a ma|
|000033f0| 6c 6c 6f 63 0a 58 09 20 | 20 66 61 74 61 6c 2c 20 |lloc.X. | fatal, |
|00003400| 61 6e 64 20 74 6f 09 6c | 6f 67 20 61 6c 6c 09 6d |and to.l|og all.m|
|00003410| 65 73 73 61 67 65 73 20 | 74 6f 20 74 68 65 09 66 |essages |to the.f|
|00003420| 69 6c 65 20 22 6d 61 6c | 6c 6f 63 5f 6c 6f 67 22 |ile "mal|loc_log"|
|00003430| 20 64 6f 0a 58 09 20 20 | 74 68 65 20 66 6f 6c 6c | do.X. |the foll|
|00003440| 6f 77 69 6e 67 3a 0a 58 | 0a 58 09 20 20 20 20 20 |owing:.X|.X. |
|00003450| 20 20 23 69 6e 63 6c 75 | 64 65 09 3c 6d 61 6c 6c | #inclu|de.<mall|
|00003460| 6f 63 2e 68 3e 0a 58 09 | 20 20 20 20 20 20 20 75 |oc.h>.X.| u|
|00003470| 6e 69 6f 6e 20 64 62 6d | 61 6c 6c 6f 70 74 61 72 |nion dbm|alloptar|
|00003480| 67 20 20 6d 3b 0a 58 0a | 58 09 20 20 20 20 20 20 |g m;.X.|X. |
|00003490| 20 6d 2e 69 20 3d 20 4d | 5f 48 41 4e 44 4c 45 5f | m.i = M|_HANDLE_|
|000034a0| 43 4f 52 45 20 7c 20 4d | 5f 48 41 4e 44 4c 45 5f |CORE | M|_HANDLE_|
|000034b0| 44 55 4d 50 3b 0a 58 09 | 20 20 20 20 20 20 20 64 |DUMP;.X.| d|
|000034c0| 62 6d 61 6c 6c 6f 70 74 | 28 4d 41 4c 4c 4f 43 5f |bmallopt|(MALLOC_|
|000034d0| 57 41 52 4e 2c 6d 29 3b | 0a 58 0a 58 09 20 20 20 |WARN,m);|.X.X. |
|000034e0| 20 20 20 20 6d 2e 69 20 | 3d 20 4d 5f 48 41 4e 44 | m.i |= M_HAND|
|000034f0| 4c 45 5f 41 42 4f 52 54 | 3b 0a 58 09 20 20 20 20 |LE_ABORT|;.X. |
|00003500| 20 20 20 64 62 6d 61 6c | 6c 6f 70 74 28 4d 41 4c | dbmal|lopt(MAL|
|00003510| 4c 4f 43 5f 46 41 54 41 | 4c 2c 6d 29 3b 0a 58 0a |LOC_FATA|L,m);.X.|
|00003520| 58 09 20 20 20 20 20 20 | 20 6d 2e 73 74 72 20 3d |X. | m.str =|
|00003530| 20 22 6d 61 6c 6c 6f 63 | 5f 6c 6f 67 22 3b 0a 58 | "malloc|_log";.X|
|00003540| 09 20 20 20 20 20 20 20 | 64 62 6d 61 6c 6c 6f 70 |. |dbmallop|
|00003550| 74 28 4d 41 4c 4c 4f 43 | 5f 45 52 52 46 49 4c 45 |t(MALLOC|_ERRFILE|
|00003560| 2c 6d 29 3b 0a 58 0a 58 | 09 20 20 64 62 6d 61 6c |,m);.X.X|. dbmal|
|00003570| 6c 6f 70 74 28 29 20 63 | 61 6e 20 62 65 20 75 73 |lopt() c|an be us|
|00003580| 65 64 20 74 6f 20 73 65 | 74 2f 61 6c 74 65 72 20 |ed to se|t/alter |
|00003590| 74 68 65 20 64 65 62 75 | 67 67 69 6e 67 20 6f 70 |the debu|gging op|
|000035a0| 74 69 6f 6e 73 0a 58 09 | 20 20 61 74 20 61 6e 79 |tions.X.| at any|
|000035b0| 20 74 69 6d 65 20 28 69 | 2e 65 2e 20 79 6f 75 09 | time (i|.e. you.|
|000035c0| 6d 61 79 20 77 61 6e 74 | 20 74 6f 20 74 75 72 6e |may want| to turn|
|000035d0| 20 6f 6e 20 63 68 61 69 | 6e 2d 63 68 65 63 6b 69 | on chai|n-checki|
|000035e0| 6e 67 0a 58 09 20 20 61 | 66 74 65 72 09 74 68 65 |ng.X. a|fter.the|
|000035f0| 20 70 72 6f 67 72 61 6d | 20 73 74 61 72 74 75 70 | program| startup|
|00003600| 20 69 66 20 74 68 65 20 | 70 72 6f 67 72 61 6d 20 | if the |program |
|00003610| 73 74 61 72 74 75 70 20 | 64 6f 65 73 09 61 20 6c |startup |does.a l|
|00003620| 6f 74 0a 58 09 20 20 6f | 66 20 61 6c 6c 6f 63 61 |ot.X. o|f alloca|
|00003630| 74 69 6f 6e 73 20 77 68 | 69 63 68 20 61 72 65 20 |tions wh|ich are |
|00003640| 6b 6e 6f 77 6e 20 74 6f | 20 62 65 20 4f 4b 29 2e |known to| be OK).|
|00003650| 0a 58 0a 58 09 20 20 6d | 61 6c 6c 6f 63 5f 63 68 |.X.X. m|alloc_ch|
|00003660| 61 69 6e 5f 63 68 65 63 | 6b 28 29 20 77 69 6c 6c |ain_chec|k() will|
|00003670| 20 63 68 65 63 6b 20 74 | 68 65 20 73 74 61 74 75 | check t|he statu|
|00003680| 73 20 6f 66 09 74 68 65 | 20 6d 61 6c 6c 6f 63 0a |s of.the| malloc.|
|00003690| 58 09 20 20 61 72 65 6e | 61 2e 20 20 49 66 20 66 |X. aren|a. If f|
|000036a0| 6c 61 67 20 69 73 20 6e | 6f 6e 2d 7a 65 72 6f 2c |lag is n|on-zero,|
|000036b0| 20 61 6e 20 65 72 72 6f | 72 09 66 6f 75 6e 64 20 | an erro|r.found |
|000036c0| 69 6e 20 74 68 65 20 63 | 68 61 69 6e 0a 58 09 20 |in the c|hain.X. |
|000036d0| 20 77 69 6c 6c 20 63 61 | 75 73 65 20 61 20 66 61 | will ca|use a fa|
|000036e0| 74 61 6c 20 65 72 72 6f | 72 2e 20 20 6d 61 6c 6c |tal erro|r. mall|
|000036f0| 6f 63 5f 63 68 61 69 6e | 5f 63 68 65 63 6b 28 29 |oc_chain|_check()|
|00003700| 20 72 65 74 75 72 6e 73 | 20 7a 65 72 6f 0a 58 09 | returns| zero.X.|
|00003710| 20 20 77 68 65 6e 20 74 | 68 65 72 65 20 61 72 65 | when t|here are|
|00003720| 20 6e 6f 20 70 72 6f 62 | 6c 65 6d 73 20 66 6f 75 | no prob|lems fou|
|00003730| 6e 64 20 69 6e 20 74 68 | 65 20 6d 61 6c 6c 6f 63 |nd in th|e malloc|
|00003740| 20 63 68 61 69 6e 2c 09 | 6e 6f 6e 2d 0a 58 09 20 | chain,.|non-.X. |
|00003750| 20 7a 65 72 6f 20 6f 74 | 68 65 72 77 69 73 65 2e | zero ot|herwise.|
|00003760| 0a 58 0a 58 09 20 20 6d | 61 6c 6c 6f 63 5f 64 75 |.X.X. m|alloc_du|
|00003770| 6d 70 28 29 09 77 69 6c | 6c 20 64 75 6d 70 20 61 |mp().wil|l dump a|
|00003780| 20 6c 69 73 74 20 6f 66 | 20 61 6c 6c 09 69 6e 2d | list of| all.in-|
|00003790| 75 73 65 20 6d 61 6c 6c | 6f 63 20 73 65 67 6d 65 |use mall|oc segme|
|000037a0| 6e 74 73 0a 58 09 20 20 | 61 6e 64 20 74 68 65 20 |nts.X. |and the |
|000037b0| 66 69 72 73 74 09 66 65 | 77 20 62 79 74 65 73 20 |first.fe|w bytes |
|000037c0| 6f 66 20 65 61 63 68 20 | 73 65 67 6d 65 6e 74 2e |of each |segment.|
|000037d0| 20 20 49 66 20 74 68 65 | 20 65 6e 76 69 72 6f 6e | If the| environ|
|000037e0| 6d 65 6e 74 0a 58 09 20 | 20 76 61 72 69 61 62 6c |ment.X. | variabl|
|000037f0| 65 20 4d 41 4c 4c 4f 43 | 5f 44 45 54 41 49 4c 20 |e MALLOC|_DETAIL |
|00003800| 69 73 20 73 65 74 09 74 | 6f 20 61 20 6e 6f 6e 2d |is set.t|o a non-|
|00003810| 7a 65 72 6f 20 69 6e 74 | 65 67 65 72 2c 20 61 6c |zero int|eger, al|
|00003820| 6c 0a 58 09 20 20 73 65 | 67 6d 65 6e 74 73 20 28 |l.X. se|gments (|
|00003830| 69 6e 63 6c 75 64 69 6e | 67 20 74 68 6f 73 65 20 |includin|g those |
|00003840| 74 68 61 74 20 68 61 76 | 65 20 62 65 65 6e 20 66 |that hav|e been f|
|00003850| 72 65 65 64 29 20 61 72 | 65 20 6c 69 73 74 65 64 |reed) ar|e listed|
|00003860| 0a 58 09 20 20 61 6e 64 | 20 61 64 64 69 74 69 6f |.X. and| additio|
|00003870| 6e 61 6c 20 69 6e 74 65 | 72 6e 61 6c 20 69 6e 66 |nal inte|rnal inf|
|00003880| 6f 72 6d 61 74 69 6f 6e | 20 69 73 20 64 69 73 70 |ormation| is disp|
|00003890| 6c 61 79 65 64 2e 20 20 | 66 64 09 69 73 20 74 68 |layed. |fd.is th|
|000038a0| 65 0a 58 09 20 20 66 69 | 6c 65 20 64 65 73 63 72 |e.X. fi|le descr|
|000038b0| 69 70 74 6f 72 20 74 6f | 20 77 72 69 74 65 20 74 |iptor to| write t|
|000038c0| 68 65 20 64 61 74 61 20 | 74 6f 2e 0a 58 0a 58 09 |he data |to..X.X.|
|000038d0| 20 20 6d 61 6c 6c 6f 63 | 5f 6c 69 73 74 28 29 09 | malloc|_list().|
|000038e0| 77 69 6c 6c 20 64 75 6d | 70 20 61 20 6c 69 73 74 |will dum|p a list|
|000038f0| 20 69 6e 20 74 68 65 09 | 73 61 6d 65 20 66 6f 72 | in the.|same for|
|00003900| 6d 61 74 20 61 73 0a 58 | 09 20 20 6d 61 6c 6c 6f |mat as.X|. mallo|
|00003910| 63 5f 64 75 6d 70 20 62 | 75 74 20 6f 6e 6c 79 20 |c_dump b|ut only |
|00003920| 74 68 65 20 69 74 65 6d | 73 20 74 68 61 74 20 61 |the item|s that a|
|00003930| 72 65 20 73 74 69 6c 6c | 09 69 6e 20 75 73 65 20 |re still|.in use |
|00003940| 61 6e 64 0a 58 09 20 20 | 77 68 69 63 68 09 68 61 |and.X. |which.ha|
|00003950| 76 65 20 62 65 65 6e 20 | 61 6c 6c 6f 63 61 74 65 |ve been |allocate|
|00003960| 64 20 77 69 74 68 69 6e | 20 74 68 65 20 6d 61 6c |d within| the mal|
|00003970| 6c 6f 63 20 68 69 73 74 | 6f 72 79 20 69 64 20 72 |loc hist|ory id r|
|00003980| 61 6e 67 65 0a 58 09 20 | 20 73 70 65 63 69 66 69 |ange.X. | specifi|
|00003990| 65 64 20 62 79 20 68 69 | 73 74 69 64 31 20 61 6e |ed by hi|stid1 an|
|000039a0| 64 20 68 69 73 74 69 64 | 32 2c 20 69 6e 63 6c 75 |d histid|2, inclu|
|000039b0| 73 69 76 65 2e 09 54 68 | 65 20 68 69 73 74 69 64 |sive..Th|e histid|
|000039c0| 73 0a 58 09 20 20 61 72 | 65 20 6f 62 74 61 69 6e |s.X. ar|e obtain|
|000039d0| 65 64 20 66 72 6f 6d 20 | 63 61 6c 6c 73 20 74 6f |ed from |calls to|
|000039e0| 20 6d 61 6c 6c 6f 63 5f | 69 6e 75 73 65 28 29 2e | malloc_|inuse().|
|000039f0| 20 54 68 69 73 20 69 73 | 0a 58 09 20 20 65 73 70 | This is|.X. esp|
|00003a00| 65 63 69 61 6c 6c 79 20 | 75 73 65 66 75 6c 20 69 |ecially |useful i|
|00003a10| 6e 20 74 72 61 63 6b 69 | 6e 67 09 64 6f 77 6e 20 |n tracki|ng.down |
|00003a20| 6d 65 6d 6f 72 79 20 6c | 65 61 6b 73 2e 20 20 66 |memory l|eaks. f|
|00003a30| 64 20 69 73 20 74 68 65 | 0a 58 09 20 20 66 69 6c |d is the|.X. fil|
|00003a40| 65 20 64 65 73 63 72 69 | 70 74 6f 72 20 74 6f 20 |e descri|ptor to |
|00003a50| 77 72 69 74 65 20 74 68 | 65 20 64 61 74 61 20 74 |write th|e data t|
|00003a60| 6f 2e 0a 58 0a 58 09 20 | 20 6d 61 6c 6c 6f 63 5f |o..X.X. | malloc_|
|00003a70| 69 6e 75 73 65 28 29 20 | 72 65 74 75 72 6e 73 20 |inuse() |returns |
|00003a80| 74 68 65 20 61 6d 6f 75 | 6e 74 20 6f 66 20 6d 61 |the amou|nt of ma|
|00003a90| 6c 6c 6f 63 20 64 61 74 | 61 20 74 68 61 74 09 69 |lloc dat|a that.i|
|00003aa0| 73 0a 58 09 20 20 63 75 | 72 72 65 6e 74 6c 79 20 |s.X. cu|rrently |
|00003ab0| 69 6e 20 75 73 65 20 28 | 69 6e 20 62 79 74 65 73 |in use (|in bytes|
|00003ac0| 29 2e 09 49 66 20 68 69 | 73 74 69 64 70 74 72 20 |)..If hi|stidptr |
|00003ad0| 69 73 09 6e 6f 74 20 4e | 55 4c 4c 2c 20 69 74 0a |is.not N|ULL, it.|
|00003ae0| 58 09 20 20 69 73 20 74 | 61 6b 65 6e 20 74 6f 20 |X. is t|aken to |
|00003af0| 62 65 20 61 20 70 6f 69 | 6e 74 65 72 20 74 6f 20 |be a poi|nter to |
|00003b00| 61 09 70 6c 61 63 65 20 | 74 6f 20 73 74 6f 72 65 |a.place |to store|
|00003b10| 20 74 68 65 20 63 75 72 | 72 65 6e 74 0a 58 09 20 | the cur|rent.X. |
|00003b20| 20 6d 61 6c 6c 6f 63 20 | 68 69 73 74 6f 72 79 20 | malloc |history |
|00003b30| 69 64 20 77 68 69 63 68 | 20 63 61 6e 20 62 65 20 |id which| can be |
|00003b40| 75 73 65 64 20 6c 61 74 | 65 72 20 77 68 65 6e 20 |used lat|er when |
|00003b50| 6d 61 6c 6c 6f 63 5f 6c | 69 73 74 0a 58 09 20 20 |malloc_l|ist.X. |
|00003b60| 69 73 20 63 61 6c 6c 65 | 64 20 74 6f 20 6c 69 73 |is calle|d to lis|
|00003b70| 74 20 69 74 65 6d 73 20 | 74 68 61 74 20 61 72 65 |t items |that are|
|00003b80| 20 73 74 69 6c 6c 20 69 | 6e 20 75 73 65 2e 0a 58 | still i|n use..X|
|00003b90| 0a 58 0a 58 0a 58 0a 58 | 0a 58 0a 58 0a 58 20 20 |.X.X.X.X|.X.X.X |
|00003ba0| 20 20 20 50 61 67 65 20 | 37 09 09 09 20 20 20 31 | Page |7... 1|
|00003bb0| 2e 31 31 0a 58 0a 58 0a | 58 0a 58 0a 58 0a 58 0a |.11.X.X.|X.X.X.X.|
|00003bc0| 58 20 20 20 20 20 44 45 | 42 55 47 5f 4d 41 4c 4c |X DE|BUG_MALL|
|00003bd0| 4f 43 28 33 29 09 09 20 | 20 20 28 56 54 49 29 09 |OC(3).. | (VTI).|
|00003be0| 20 20 20 20 20 20 20 44 | 45 42 55 47 5f 4d 41 4c | D|EBUG_MAL|
|00003bf0| 4c 4f 43 28 33 29 0a 58 | 0a 58 0a 58 0a 58 09 20 |LOC(3).X|.X.X.X. |
|00003c00| 20 54 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 09 65 | The fol|lowing.e|
|00003c10| 78 61 6d 70 6c 65 09 73 | 68 6f 77 73 20 74 68 65 |xample.s|hows the|
|00003c20| 20 74 79 70 69 63 61 6c | 20 75 73 65 20 6f 66 20 | typical| use of |
|00003c30| 74 68 65 0a 58 09 20 20 | 6d 61 6c 6c 6f 63 5f 69 |the.X. |malloc_i|
|00003c40| 6e 75 73 65 20 61 6e 64 | 20 6d 61 6c 6c 6f 63 5f |nuse and| malloc_|
|00003c50| 6c 69 73 74 20 66 75 6e | 63 74 69 6f 6e 73 20 69 |list fun|ctions i|
|00003c60| 6e 20 74 72 61 63 6b 69 | 6e 67 20 64 6f 77 6e 0a |n tracki|ng down.|
|00003c70| 58 09 20 20 6d 65 6d 6f | 72 79 20 6c 65 61 6b 73 |X. memo|ry leaks|
|00003c80| 3a 0a 58 0a 58 09 20 20 | 20 20 20 20 20 75 6e 73 |:.X.X. | uns|
|00003c90| 69 67 6e 65 64 09 6c 6f | 6e 67 20 20 68 69 73 74 |igned.lo|ng hist|
|00003ca0| 69 64 31 2c 20 68 69 73 | 74 69 64 32 2c 09 6f 72 |id1, his|tid2,.or|
|00003cb0| 69 67 5f 73 69 7a 65 2c | 20 63 75 72 72 65 6e 74 |ig_size,| current|
|00003cc0| 5f 73 69 7a 65 3b 0a 58 | 0a 58 09 20 20 20 20 20 |_size;.X|.X. |
|00003cd0| 20 20 6f 72 69 67 5f 73 | 69 7a 65 20 3d 20 6d 61 | orig_s|ize = ma|
|00003ce0| 6c 6c 6f 63 5f 69 6e 75 | 73 65 28 26 68 69 73 74 |lloc_inu|se(&hist|
|00003cf0| 69 64 31 29 3b 0a 58 0a | 58 09 20 20 20 20 20 20 |id1);.X.|X. |
|00003d00| 20 2f 2a 20 2e 2e 2e 2e | 2e 09 67 6f 20 64 6f 20 | /* ....|..go do |
|00003d10| 6c 6f 74 73 20 6f 66 20 | 73 74 75 66 66 20 2e 2e |lots of |stuff ..|
|00003d20| 2e 2e 2e 2e 20 2a 2f 0a | 58 0a 58 09 20 20 20 20 |.... */.|X.X. |
|00003d30| 20 20 20 63 75 72 72 65 | 6e 74 5f 73 69 7a 65 20 | curre|nt_size |
|00003d40| 3d 20 6d 61 6c 6c 6f 63 | 5f 69 6e 75 73 65 28 26 |= malloc|_inuse(&|
|00003d50| 68 69 73 74 69 64 32 29 | 3b 0a 58 0a 58 09 20 20 |histid2)|;.X.X. |
|00003d60| 20 20 20 20 20 69 66 28 | 20 63 75 72 72 65 6e 74 | if(| current|
|00003d70| 5f 73 69 7a 65 09 21 3d | 20 6f 72 69 67 5f 73 69 |_size.!=| orig_si|
|00003d80| 7a 65 20 29 0a 58 09 20 | 20 20 20 20 20 20 7b 0a |ze ).X. | {.|
|00003d90| 58 09 09 20 20 20 20 6d | 61 6c 6c 6f 63 5f 6c 69 |X.. m|alloc_li|
|00003da0| 73 74 28 32 2c 68 69 73 | 74 69 64 31 2c 68 69 73 |st(2,his|tid1,his|
|00003db0| 74 69 64 32 29 3b 0a 58 | 09 20 20 20 20 20 20 20 |tid2);.X|. |
|00003dc0| 7d 0a 58 0a 58 09 20 20 | 6d 61 6c 6c 6f 63 5f 6d |}.X.X. |malloc_m|
|00003dd0| 61 72 6b 28 29 09 6d 61 | 72 6b 73 20 61 09 73 65 |ark().ma|rks a.se|
|00003de0| 67 6d 65 6e 74 09 61 73 | 20 61 20 6e 6f 6e 2d 6c |gment.as| a non-l|
|00003df0| 65 61 6b 2e 09 53 65 67 | 6d 65 6e 74 73 20 74 68 |eak..Seg|ments th|
|00003e00| 61 74 0a 58 09 20 20 61 | 72 65 20 6d 61 72 6b 65 |at.X. a|re marke|
|00003e10| 64 20 61 72 65 20 6e 6f | 74 20 63 6f 75 6e 74 65 |d are no|t counte|
|00003e20| 64 20 6f 72 09 6c 69 73 | 74 65 64 20 77 68 65 6e |d or.lis|ted when|
|00003e30| 20 64 65 61 6c 69 6e 67 | 20 77 69 74 68 0a 58 09 | dealing| with.X.|
|00003e40| 20 20 6d 65 6d 6f 72 79 | 20 6c 65 61 6b 73 2e 09 | memory| leaks..|
|00003e50| 20 54 68 69 73 20 69 73 | 20 64 65 73 69 67 6e 65 | This is| designe|
|00003e60| 64 20 74 6f 20 62 65 09 | 75 73 65 64 20 6f 6e 09 |d to be.|used on.|
|00003e70| 70 6f 69 6e 74 65 72 73 | 20 74 68 61 74 0a 58 09 |pointers| that.X.|
|00003e80| 20 20 72 65 6d 61 69 6e | 20 61 72 6f 75 6e 64 09 | remain| around.|
|00003e90| 66 6f 72 65 76 65 72 09 | 61 6e 64 20 73 68 6f 75 |forever.|and shou|
|00003ea0| 6c 64 6e 27 74 20 62 65 | 20 63 6f 6e 73 69 64 65 |ldn't be| conside|
|00003eb0| 72 65 64 20 74 6f 20 62 | 65 20 61 0a 58 09 20 20 |red to b|e a.X. |
|00003ec0| 6c 65 61 6b 20 28 69 6e | 20 6f 72 64 65 72 20 74 |leak (in| order t|
|00003ed0| 6f 20 64 65 63 72 65 61 | 73 65 20 74 68 65 20 61 |o decrea|se the a|
|00003ee0| 6d 6f 75 6e 74 09 6f 66 | 20 65 6e 74 72 69 65 73 |mount.of| entries|
|00003ef0| 20 69 6e 20 74 68 65 20 | 6c 65 61 6b 0a 58 09 20 | in the |leak.X. |
|00003f00| 20 6c 69 73 74 73 29 0a | 58 0a 58 09 20 20 6d 61 | lists).|X.X. ma|
|00003f10| 6c 6c 6f 63 5f 61 62 6f | 72 74 28 29 20 63 61 75 |lloc_abo|rt() cau|
|00003f20| 73 65 73 09 74 68 65 20 | 63 75 72 72 65 6e 74 20 |ses.the |current |
|00003f30| 70 72 6f 67 72 61 6d 20 | 74 6f 20 64 72 6f 70 20 |program |to drop |
|00003f40| 63 6f 72 65 20 61 6e 64 | 0a 58 09 20 20 65 78 69 |core and|.X. exi|
|00003f50| 74 2e 09 20 54 68 69 73 | 20 66 75 6e 63 74 69 6f |t.. This| functio|
|00003f60| 6e 20 73 69 6d 70 6c 79 | 20 63 61 6c 6c 73 20 61 |n simply| calls a|
|00003f70| 62 6f 72 74 28 29 20 74 | 6f 20 64 6f 20 69 74 73 |bort() t|o do its|
|00003f80| 20 64 69 72 74 79 0a 58 | 09 20 20 77 6f 72 6b 20 | dirty.X|. work |
|00003f90| 61 6e 64 20 69 73 20 68 | 65 72 65 20 73 6f 6c 65 |and is h|ere sole|
|00003fa0| 6c 79 20 66 6f 72 20 74 | 68 65 20 70 75 72 70 6f |ly for t|he purpo|
|00003fb0| 73 65 20 6f 66 20 61 6c | 6c 6f 77 69 6e 67 20 74 |se of al|lowing t|
|00003fc0| 68 65 0a 58 09 20 20 70 | 72 6f 67 72 61 6d 6d 65 |he.X. p|rogramme|
|00003fd0| 72 20 74 6f 09 73 75 62 | 73 74 69 74 75 74 65 20 |r to.sub|stitute |
|00003fe0| 74 68 69 65 72 20 6f 77 | 6e 20 61 62 6f 72 74 20 |thier ow|n abort |
|00003ff0| 72 6f 75 74 69 6e 65 20 | 74 6f 20 68 61 6e 64 6c |routine |to handl|
|00004000| 65 0a 58 09 20 20 66 61 | 74 61 6c 09 65 72 72 6f |e.X. fa|tal.erro|
|00004010| 72 73 2e 09 20 49 66 20 | 61 20 73 75 62 73 74 69 |rs.. If |a substi|
|00004020| 74 75 74 65 20 72 6f 75 | 74 69 6e 65 20 69 73 20 |tute rou|tine is |
|00004030| 75 73 65 64 2c 20 69 74 | 20 6d 75 73 74 20 6e 6f |used, it| must no|
|00004040| 74 0a 58 09 20 20 72 65 | 74 75 72 6e 20 74 6f 20 |t.X. re|turn to |
|00004050| 74 68 65 09 63 61 6c 6c | 65 72 20 6f 72 20 65 6c |the.call|er or el|
|00004060| 73 65 20 74 68 65 20 70 | 72 6f 67 72 61 6d 20 77 |se the p|rogram w|
|00004070| 69 6c 6c 09 75 73 65 20 | 74 68 65 0a 58 09 20 20 |ill.use |the.X. |
|00004080| 61 62 6f 72 74 28 29 20 | 73 79 73 74 65 6d 20 63 |abort() |system c|
|00004090| 61 6c 6c 20 74 6f 20 63 | 61 75 73 65 20 74 68 65 |all to c|ause the|
|000040a0| 20 70 72 6f 67 72 61 6d | 20 74 6f 20 73 74 6f 70 | program| to stop|
|000040b0| 2e 0a 58 0a 58 09 20 20 | 6d 61 6c 6c 6f 63 5f 65 |..X.X. |malloc_e|
|000040c0| 6e 74 65 72 28 29 20 61 | 6e 64 20 6d 61 6c 6c 6f |nter() a|nd mallo|
|000040d0| 63 5f 6c 65 61 76 65 28 | 29 20 70 72 6f 76 69 64 |c_leave(|) provid|
|000040e0| 65 20 61 20 72 75 64 69 | 6d 65 6e 74 61 72 79 0a |e a rudi|mentary.|
|000040f0| 58 09 20 20 6d 65 63 68 | 61 6e 69 73 6d 20 74 6f |X. mech|anism to|
|00004100| 20 74 72 61 63 6b 20 74 | 68 65 20 63 61 6c 6c 69 | track t|he calli|
|00004110| 6e 67 20 73 74 61 63 6b | 20 74 68 61 74 20 77 61 |ng stack| that wa|
|00004120| 73 09 69 6e 20 70 6c 61 | 63 65 20 77 68 65 6e 0a |s.in pla|ce when.|
|00004130| 58 09 20 20 74 68 65 20 | 61 6c 6c 6f 63 61 74 69 |X. the |allocati|
|00004140| 6f 6e 20 77 61 73 20 6d | 61 64 65 2e 20 20 49 6e |on was m|ade. In|
|00004150| 20 6f 72 64 65 72 20 74 | 6f 09 75 73 65 20 74 68 | order t|o.use th|
|00004160| 69 73 20 66 65 61 74 75 | 72 65 2c 20 74 68 65 0a |is featu|re, the.|
|00004170| 58 09 20 20 65 6e 74 65 | 72 09 66 75 6e 63 74 69 |X. ente|r.functi|
|00004180| 6f 6e 20 73 68 6f 75 6c | 64 09 62 65 20 63 61 6c |on shoul|d.be cal|
|00004190| 6c 65 64 20 75 70 6f 6e | 20 65 6e 74 72 79 20 74 |led upon| entry t|
|000041a0| 6f 09 61 20 66 75 6e 63 | 74 69 6f 6e 2c 0a 58 09 |o.a func|tion,.X.|
|000041b0| 20 20 77 68 69 6c 65 09 | 74 68 65 20 6c 65 61 76 | while.|the leav|
|000041c0| 65 20 66 75 6e 63 74 69 | 6f 6e 20 69 73 20 63 61 |e functi|on is ca|
|000041d0| 6c 6c 65 64 20 77 68 65 | 6e 20 79 6f 75 20 65 78 |lled whe|n you ex|
|000041e0| 69 74 20 66 72 6f 6d 09 | 74 68 65 0a 58 09 20 20 |it from.|the.X. |
|000041f0| 66 75 6e 63 74 69 6f 6e | 2e 20 20 49 6e 09 6f 72 |function|. In.or|
|00004200| 64 65 72 20 74 6f 20 62 | 65 20 61 63 63 75 72 61 |der to b|e accura|
|00004210| 74 65 2c 20 74 68 65 20 | 74 77 6f 20 66 75 6e 63 |te, the |two func|
|00004220| 74 69 6f 6e 73 09 6d 75 | 73 74 0a 58 09 20 20 62 |tions.mu|st.X. b|
|00004230| 65 20 75 73 65 64 20 69 | 6e 20 63 6f 6e 6a 75 6e |e used i|n conjun|
|00004240| 63 74 69 6f 6e 20 77 69 | 74 68 20 65 61 63 68 20 |ction wi|th each |
|00004250| 6f 74 68 65 72 20 61 6e | 64 20 61 20 6d 69 73 73 |other an|d a miss|
|00004260| 69 6e 67 20 63 61 6c 6c | 0a 58 09 20 20 77 69 6c |ing call|.X. wil|
|00004270| 6c 20 72 65 73 75 6c 74 | 20 69 6e 20 61 6e 20 65 |l result| in an e|
|00004280| 72 72 6f 72 20 67 65 6e | 65 72 61 74 65 64 20 62 |rror gen|erated b|
|00004290| 79 20 74 68 65 20 6c 69 | 62 72 61 72 79 20 28 69 |y the li|brary (i|
|000042a0| 66 20 69 74 20 69 73 0a | 58 09 20 20 64 65 74 65 |f it is.|X. dete|
|000042b0| 63 74 65 64 29 2e 0a 58 | 0a 58 09 20 20 4e 4f 54 |cted)..X|.X. NOT|
|000042c0| 45 3a 09 74 68 65 20 61 | 72 67 75 6d 65 6e 74 20 |E:.the a|rgument |
|000042d0| 74 6f 09 65 69 74 68 65 | 72 20 6f 66 20 74 68 65 |to.eithe|r of the|
|000042e0| 73 65 09 66 75 6e 63 74 | 69 6f 6e 73 20 6d 75 73 |se.funct|ions mus|
|000042f0| 74 20 62 65 20 61 0a 58 | 09 20 20 63 6f 6e 73 74 |t be a.X|. const|
|00004300| 61 6e 74 20 63 68 61 72 | 61 63 74 65 72 20 73 74 |ant char|acter st|
|00004310| 72 69 6e 67 20 6f 72 20 | 61 20 73 74 61 74 69 63 |ring or |a static|
|00004320| 09 64 61 74 61 20 61 72 | 65 61 2e 20 20 54 68 69 |.data ar|ea. Thi|
|00004330| 73 20 69 73 0a 58 09 20 | 20 62 65 63 61 75 73 65 |s is.X. | because|
|00004340| 20 74 68 65 20 73 74 61 | 63 6b 20 6d 65 63 68 61 | the sta|ck mecha|
|00004350| 6e 69 73 6d 20 64 6f 65 | 73 20 6e 6f 74 20 6d 61 |nism doe|s not ma|
|00004360| 69 6e 74 61 69 6e 09 69 | 74 27 73 20 6f 77 6e 20 |intain.i|t's own |
|00004370| 63 6f 70 79 0a 58 09 20 | 20 6f 66 20 74 68 65 73 |copy.X. | of thes|
|00004380| 65 20 73 74 72 69 6e 67 | 73 2c 20 69 74 20 6a 75 |e string|s, it ju|
|00004390| 73 74 20 72 65 63 6f 72 | 64 73 20 70 6f 69 6e 74 |st recor|ds point|
|000043a0| 65 72 73 20 74 6f 09 74 | 68 65 20 73 74 72 69 6e |ers to.t|he strin|
|000043b0| 67 73 0a 58 09 20 20 61 | 6e 64 20 69 66 20 74 68 |gs.X. a|nd if th|
|000043c0| 65 20 73 74 72 69 6e 67 | 73 20 61 72 65 20 6f 6e |e string|s are on|
|000043d0| 20 74 68 65 09 73 74 61 | 63 6b 2c 20 74 68 65 79 | the.sta|ck, they|
|000043e0| 20 77 69 6c 6c 20 67 6f | 20 61 77 61 79 2e 0a 58 | will go| away..X|
|000043f0| 09 20 20 54 79 70 69 63 | 61 6c 6c 79 20 74 68 65 |. Typic|ally the|
|00004400| 09 66 75 6e 63 74 69 6f | 6e 73 20 77 6f 75 6c 64 |.functio|ns would|
|00004410| 09 62 65 20 75 73 65 64 | 09 77 69 74 68 20 22 66 |.be used|.with "f|
|00004420| 75 6e 63 6e 61 6d 65 22 | 09 61 73 20 74 68 65 0a |uncname"|.as the.|
|00004430| 58 09 20 20 61 72 67 75 | 6d 65 6e 74 20 61 6e 64 |X. argu|ment and|
|00004440| 20 74 68 69 73 20 77 69 | 6c 6c 20 61 76 6f 69 64 | this wi|ll avoid|
|00004450| 20 61 6e 79 20 70 72 6f | 62 6c 65 6d 73 2e 0a 58 | any pro|blems..X|
|00004460| 0a 58 0a 58 0a 58 0a 58 | 0a 58 0a 58 20 20 20 20 |.X.X.X.X|.X.X |
|00004470| 20 50 61 67 65 20 38 09 | 09 09 20 20 20 31 2e 31 | Page 8.|.. 1.1|
|00004480| 31 0a 58 0a 58 0a 58 0a | 58 0a 58 0a 58 0a 58 20 |1.X.X.X.|X.X.X.X |
|00004490| 20 20 20 20 44 45 42 55 | 47 5f 4d 41 4c 4c 4f 43 | DEBU|G_MALLOC|
|000044a0| 28 33 29 09 09 20 20 20 | 28 56 54 49 29 09 20 20 |(3).. |(VTI). |
|000044b0| 20 20 20 20 20 44 45 42 | 55 47 5f 4d 41 4c 4c 4f | DEB|UG_MALLO|
|000044c0| 43 28 33 29 0a 58 0a 58 | 0a 58 0a 58 09 20 20 54 |C(3).X.X|.X.X. T|
|000044d0| 68 65 20 73 74 61 63 6b | 20 69 73 20 6c 69 73 74 |he stack| is list|
|000044e0| 65 64 20 6f 6e 20 74 68 | 65 20 64 75 6d 70 20 61 |ed on th|e dump a|
|000044f0| 6e 64 2f 6f 72 20 6c 69 | 73 74 20 72 65 70 6f 72 |nd/or li|st repor|
|00004500| 74 73 20 61 6e 64 20 6f | 6e 0a 58 09 20 20 61 6e |ts and o|n.X. an|
|00004510| 20 65 72 72 6f 72 20 6d | 65 73 73 61 67 65 20 66 | error m|essage f|
|00004520| 6f 72 20 61 20 73 65 67 | 6d 65 6e 74 20 74 68 61 |or a seg|ment tha|
|00004530| 74 20 68 61 73 20 61 6c | 72 65 61 64 79 20 62 65 |t has al|ready be|
|00004540| 65 6e 20 66 72 65 65 64 | 2e 0a 58 0a 58 09 20 20 |en freed|..X.X. |
|00004550| 49 66 20 74 68 65 73 65 | 20 66 75 6e 63 74 69 6f |If these| functio|
|00004560| 6e 73 20 68 61 76 65 20 | 62 65 65 6e 20 75 73 65 |ns have |been use|
|00004570| 64 2c 20 65 72 72 6f 72 | 20 6d 65 73 73 61 67 65 |d, error| message|
|00004580| 73 20 77 69 6c 6c 0a 58 | 09 20 20 69 6e 63 6c 75 |s will.X|. inclu|
|00004590| 64 65 20 74 68 65 20 73 | 74 61 63 6b 20 69 6e 66 |de the s|tack inf|
|000045a0| 6f 72 6d 61 74 69 6f 6e | 09 77 68 65 6e 20 74 68 |ormation|.when th|
|000045b0| 65 20 69 64 65 6e 74 69 | 74 79 20 6f 66 20 74 68 |e identi|ty of th|
|000045c0| 65 20 65 72 72 6f 72 0a | 58 09 20 20 69 73 20 64 |e error.|X. is d|
|000045d0| 69 73 70 6c 61 79 65 64 | 2e 09 20 46 6f 72 20 65 |isplayed|.. For e|
|000045e0| 78 61 6d 70 6c 65 3a 0a | 58 0a 58 09 20 20 20 20 |xample:.|X.X. |
|000045f0| 20 20 20 54 68 69 73 20 | 65 72 72 6f 72 20 69 73 | This |error is|
|00004600| 20 2a 70 72 6f 62 61 62 | 6c 79 2a 09 61 73 73 6f | *probab|ly*.asso|
|00004610| 63 69 61 74 65 64 20 77 | 69 74 68 09 74 68 65 20 |ciated w|ith.the |
|00004620| 66 6f 6c 6c 6f 77 69 6e | 67 20 61 6c 6c 6f 63 61 |followin|g alloca|
|00004630| 74 69 6f 6e 3a 0a 58 0a | 58 09 09 20 20 20 41 20 |tion:.X.|X.. A |
|00004640| 63 61 6c 6c 20 74 6f 20 | 6d 61 6c 6c 6f 63 20 66 |call to |malloc f|
|00004650| 6f 72 09 31 20 62 79 74 | 65 73 09 69 6e 20 74 65 |or.1 byt|es.in te|
|00004660| 73 74 73 74 61 63 6b 2e | 63 20 6f 6e 20 6c 69 6e |ststack.|c on lin|
|00004670| 65 20 37 35 2e 0a 58 09 | 09 20 20 20 54 68 69 73 |e 75..X.|. This|
|00004680| 09 77 61 73 20 74 68 65 | 09 31 33 74 68 20 63 61 |.was the|.13th ca|
|00004690| 6c 6c 20 74 6f 20 6d 61 | 6c 6c 6f 63 2e 0a 58 09 |ll to ma|lloc..X.|
|000046a0| 09 20 20 20 53 74 61 63 | 6b 20 66 72 6f 6d 20 77 |. Stac|k from w|
|000046b0| 68 65 72 65 20 61 6c 6c | 6f 63 61 74 65 64 3a 0a |here all|ocated:.|
|000046c0| 58 09 09 20 20 20 20 2d | 3e 20 73 75 62 33 28 29 |X.. -|> sub3()|
|000046d0| 20 69 6e 20 74 65 73 74 | 73 74 61 63 6b 2e 63 28 | in test|stack.c(|
|000046e0| 37 33 29 0a 58 09 09 20 | 20 20 20 2d 3e 20 73 75 |73).X.. | -> su|
|000046f0| 62 32 28 29 20 69 6e 20 | 74 65 73 74 73 74 61 63 |b2() in |teststac|
|00004700| 6b 2e 63 28 35 39 29 0a | 58 09 09 20 20 20 20 2d |k.c(59).|X.. -|
|00004710| 3e 20 6d 61 69 6e 28 29 | 20 69 6e 20 74 65 73 74 |> main()| in test|
|00004720| 73 74 61 63 6b 2e 63 28 | 32 33 29 0a 58 0a 58 0a |stack.c(|23).X.X.|
|00004730| 58 0a 58 20 20 20 20 20 | 55 53 41 47 45 0a 58 09 |X.X |USAGE.X.|
|00004740| 20 20 54 68 65 20 6c 69 | 62 72 61 72 79 20 63 61 | The li|brary ca|
|00004750| 6e 20 62 65 20 75 73 65 | 64 20 69 6e 20 73 65 76 |n be use|d in sev|
|00004760| 65 72 61 6c 20 6d 6f 64 | 65 73 2c 20 65 61 63 68 |eral mod|es, each|
|00004770| 20 69 6e 63 72 65 61 73 | 69 6e 67 6c 79 0a 58 09 | increas|ingly.X.|
|00004780| 20 20 69 6e 74 72 75 73 | 69 76 65 20 28 69 2e 65 | intrus|ive (i.e|
|00004790| 2e 20 72 65 71 75 69 72 | 69 6e 67 20 63 68 61 6e |. requir|ing chan|
|000047a0| 67 65 73 20 74 6f 20 62 | 65 20 6d 61 64 65 20 74 |ges to b|e made t|
|000047b0| 6f 20 74 68 65 20 62 75 | 69 6c 64 0a 58 09 20 20 |o the bu|ild.X. |
|000047c0| 70 72 6f 63 65 73 73 20 | 61 6e 64 2f 6f 72 20 73 |process |and/or s|
|000047d0| 6f 75 72 63 65 09 63 6f | 64 65 29 2e 09 48 6f 77 |ource.co|de)..How|
|000047e0| 65 76 65 72 2c 20 74 68 | 65 20 65 78 74 72 61 20 |ever, th|e extra |
|000047f0| 63 6f 73 74 09 6f 66 20 | 61 0a 58 09 20 20 6c 69 |cost.of |a.X. li|
|00004800| 74 74 6c 65 20 69 6e 74 | 72 75 73 69 76 65 6e 65 |ttle int|rusivene|
|00004810| 73 73 20 69 73 20 72 65 | 70 61 69 64 20 69 6e 20 |ss is re|paid in |
|00004820| 6d 75 63 68 20 62 65 74 | 74 65 72 09 70 72 6f 62 |much bet|ter.prob|
|00004830| 6c 65 6d 0a 58 09 20 20 | 69 64 65 6e 74 69 66 69 |lem.X. |identifi|
|00004840| 63 61 74 69 6f 6e 2e 20 | 20 45 61 63 68 09 6d 6f |cation. | Each.mo|
|00004850| 64 65 20 69 73 09 62 75 | 69 6c 74 20 75 70 6f 6e |de is.bu|ilt upon|
|00004860| 20 74 68 65 20 70 72 65 | 76 69 6f 75 73 09 6d 6f | the pre|vious.mo|
|00004870| 64 65 73 0a 58 09 20 20 | 61 6e 64 20 74 68 65 72 |des.X. |and ther|
|00004880| 65 66 6f 72 65 09 72 65 | 71 75 69 72 65 73 20 74 |efore.re|quires t|
|00004890| 68 65 20 63 68 61 6e 67 | 65 73 20 61 6e 64 2f 6f |he chang|es and/o|
|000048a0| 72 20 63 6f 6d 6d 61 6e | 64 73 20 73 70 65 63 69 |r comman|ds speci|
|000048b0| 66 69 65 64 0a 58 09 20 | 20 69 6e 20 74 68 65 20 |fied.X. | in the |
|000048c0| 6c 6f 77 65 72 20 6d 6f | 64 65 73 2e 0a 58 0a 58 |lower mo|des..X.X|
|000048d0| 09 20 20 4d 4f 44 45 20 | 31 20 2d 20 6c 69 62 72 |. MODE |1 - libr|
|000048e0| 61 72 79 20 73 75 62 73 | 74 69 74 75 74 69 6f 6e |ary subs|titution|
|000048f0| 0a 58 0a 58 09 20 20 54 | 68 65 20 73 69 6d 70 6c |.X.X. T|he simpl|
|00004900| 65 73 74 20 75 73 65 20 | 69 73 20 74 6f 20 6a 75 |est use |is to ju|
|00004910| 73 74 20 6c 69 6e 6b 20 | 74 68 65 20 6f 62 6a 65 |st link |the obje|
|00004920| 63 74 20 6d 6f 64 75 6c | 65 20 77 69 74 68 20 74 |ct modul|e with t|
|00004930| 68 65 0a 58 09 20 20 6c | 69 62 64 62 6d 61 6c 6c |he.X. l|ibdbmall|
|00004940| 6f 63 2e 61 2e 20 20 42 | 65 20 73 75 72 65 20 74 |oc.a. B|e sure t|
|00004950| 6f 20 68 61 76 65 20 74 | 68 69 73 20 6c 69 62 72 |o have t|his libr|
|00004960| 61 72 79 20 62 65 66 6f | 72 65 20 74 68 65 20 43 |ary befo|re the C|
|00004970| 0a 58 09 20 20 6c 69 62 | 72 61 72 79 20 28 6c 69 |.X. lib|rary (li|
|00004980| 62 63 2e 61 29 20 6f 6e | 20 74 68 65 20 6c 69 6e |bc.a) on| the lin|
|00004990| 6b 20 63 6f 6d 6d 61 6e | 64 20 28 74 68 69 73 20 |k comman|d (this |
|000049a0| 69 73 09 61 75 74 6f 6d | 61 74 69 63 20 69 66 0a |is.autom|atic if.|
|000049b0| 58 09 20 20 79 6f 75 20 | 75 73 65 20 63 63 20 74 |X. you |use cc t|
|000049c0| 6f 09 6c 69 6e 6b 20 61 | 6e 64 20 73 70 65 63 69 |o.link a|nd speci|
|000049d0| 66 79 20 74 68 65 20 64 | 65 62 75 67 20 6c 69 62 |fy the d|ebug lib|
|000049e0| 72 61 72 79 20 77 69 74 | 68 6f 75 74 0a 58 09 20 |rary wit|hout.X. |
|000049f0| 20 73 70 65 63 69 66 79 | 69 6e 67 20 74 68 65 20 | specify|ing the |
|00004a00| 43 20 6c 69 62 72 61 72 | 79 29 2e 0a 58 0a 58 09 |C librar|y)..X.X.|
|00004a10| 20 20 54 68 69 73 20 6d | 6f 64 65 20 6c 69 6e 6b | This m|ode link|
|00004a20| 73 20 69 6e 20 61 6c 6c | 20 6f 66 20 74 68 65 09 |s in all| of the.|
|00004a30| 64 65 62 75 67 20 76 65 | 72 73 69 6f 6e 73 20 6f |debug ve|rsions o|
|00004a40| 66 20 74 68 65 20 6c 69 | 62 72 61 72 79 0a 58 09 |f the li|brary.X.|
|00004a50| 20 20 6d 6f 64 75 6c 65 | 73 20 61 6e 64 20 77 69 | module|s and wi|
|00004a60| 6c 6c 20 74 72 61 70 09 | 61 73 20 6d 61 6e 79 09 |ll trap.|as many.|
|00004a70| 65 72 72 6f 72 73 20 61 | 73 20 69 74 20 63 61 6e |errors a|s it can|
|00004a80| 20 28 79 65 73 2c 20 74 | 68 65 72 65 0a 58 09 20 | (yes, t|here.X. |
|00004a90| 20 61 72 65 20 65 72 72 | 6f 72 73 20 74 68 61 74 | are err|ors that|
|00004aa0| 20 74 68 65 20 6d 61 6c | 6c 6f 63 20 6c 69 62 72 | the mal|loc libr|
|00004ab0| 61 72 79 20 63 61 6e 6e | 6f 74 20 63 61 74 63 68 |ary cann|ot catch|
|00004ac0| 29 2e 0a 58 09 20 20 45 | 6e 76 69 72 6f 6e 6d 65 |)..X. E|nvironme|
|00004ad0| 6e 74 20 76 61 72 69 61 | 62 6c 65 73 09 63 61 6e |nt varia|bles.can|
|00004ae0| 20 62 65 20 75 73 65 64 | 20 74 6f 20 63 6f 6e 74 | be used| to cont|
|00004af0| 72 6f 6c 20 74 68 65 20 | 62 65 68 61 76 69 6f 72 |rol the |behavior|
|00004b00| 20 6f 66 0a 58 09 20 20 | 74 68 65 20 6c 69 62 72 | of.X. |the libr|
|00004b10| 61 72 79 2e 0a 58 0a 58 | 0a 58 0a 58 0a 58 0a 58 |ary..X.X|.X.X.X.X|
|00004b20| 0a 58 0a 58 0a 58 0a 58 | 0a 58 0a 58 0a 58 0a 58 |.X.X.X.X|.X.X.X.X|
|00004b30| 0a 58 0a 58 20 20 20 20 | 20 50 61 67 65 20 39 09 |.X.X | Page 9.|
|00004b40| 09 09 20 20 20 31 2e 31 | 31 0a 58 0a 58 0a 58 0a |.. 1.1|1.X.X.X.|
|00004b50| 58 0a 58 0a 58 0a 58 20 | 20 20 20 20 44 45 42 55 |X.X.X.X | DEBU|
|00004b60| 47 5f 4d 41 4c 4c 4f 43 | 28 33 29 09 09 20 20 20 |G_MALLOC|(3).. |
|00004b70| 28 56 54 49 29 09 20 20 | 20 20 20 20 20 44 45 42 |(VTI). | DEB|
|00004b80| 55 47 5f 4d 41 4c 4c 4f | 43 28 33 29 0a 58 0a 58 |UG_MALLO|C(3).X.X|
|00004b90| 0a 58 0a 58 09 20 20 4d | 4f 44 45 20 32 20 2d 20 |.X.X. M|ODE 2 - |
|00004ba0| 6d 61 6c 6c 6f 63 2e 68 | 20 69 6e 63 6c 75 73 69 |malloc.h| inclusi|
|00004bb0| 6f 6e 0a 58 0a 58 09 20 | 20 54 68 69 73 20 6d 6f |on.X.X. | This mo|
|00004bc0| 64 65 20 69 6e 76 6f 6c | 76 65 73 20 69 6e 63 6c |de invol|ves incl|
|00004bd0| 75 64 69 6e 67 20 74 68 | 65 20 6d 61 6c 6c 6f 63 |uding th|e malloc|
|00004be0| 2e 68 20 66 69 6c 65 20 | 69 6e 63 6c 75 64 65 64 |.h file |included|
|00004bf0| 20 77 69 74 68 0a 58 09 | 20 20 74 68 65 20 64 65 | with.X.| the de|
|00004c00| 62 75 67 67 69 6e 67 09 | 6c 69 62 72 61 72 79 2e |bugging.|library.|
|00004c10| 20 20 54 68 65 20 6d 61 | 6c 6c 6f 63 2e 68 20 66 | The ma|lloc.h f|
|00004c20| 69 6c 65 20 69 6e 63 6c | 75 64 65 73 20 6d 61 63 |ile incl|udes mac|
|00004c30| 72 6f 73 0a 58 09 20 20 | 74 68 61 74 20 77 69 6c |ros.X. |that wil|
|00004c40| 6c 20 69 64 65 6e 74 69 | 66 79 20 74 68 65 20 73 |l identi|fy the s|
|00004c50| 6f 75 72 63 65 09 6c 69 | 6e 65 20 61 6e 64 20 66 |ource.li|ne and f|
|00004c60| 69 6c 65 20 6e 61 6d 65 | 20 66 6f 72 20 65 61 63 |ile name| for eac|
|00004c70| 68 0a 58 09 20 20 64 65 | 62 75 67 67 69 6e 67 20 |h.X. de|bugging |
|00004c80| 66 75 6e 63 74 69 6f 6e | 20 63 61 6c 6c 65 64 2e |function| called.|
|00004c90| 20 20 54 68 69 73 20 69 | 73 20 68 6f 77 20 74 68 | This i|s how th|
|00004ca0| 65 20 6c 69 62 72 61 72 | 79 20 69 73 20 61 62 6c |e librar|y is abl|
|00004cb0| 65 0a 58 09 20 20 74 6f | 20 74 65 6c 6c 20 79 6f |e.X. to| tell yo|
|00004cc0| 75 20 74 68 61 74 20 69 | 74 20 77 61 73 20 74 68 |u that i|t was th|
|00004cd0| 65 20 63 61 6c 6c 20 74 | 6f 20 6d 61 6c 6c 6f 63 |e call t|o malloc|
|00004ce0| 20 6f 6e 09 6c 69 6e 65 | 20 35 35 09 69 6e 0a 58 | on.line| 55.in.X|
|00004cf0| 09 20 20 66 69 6c 65 20 | 6a 75 6e 6b 2e 63 2e 0a |. file |junk.c..|
|00004d00| 58 0a 58 09 20 20 54 79 | 70 69 63 61 6c 6c 79 20 |X.X. Ty|pically |
|00004d10| 79 6f 75 09 73 68 6f 75 | 6c 64 20 61 6c 77 61 79 |you.shou|ld alway|
|00004d20| 73 20 69 6e 63 6c 75 64 | 65 20 6d 61 6c 6c 6f 63 |s includ|e malloc|
|00004d30| 2e 68 20 69 6e 20 79 6f | 75 72 20 73 6f 75 72 63 |.h in yo|ur sourc|
|00004d40| 65 0a 58 09 20 20 66 69 | 6c 65 73 09 61 6e 64 20 |e.X. fi|les.and |
|00004d50| 6a 75 73 74 20 75 73 65 | 20 74 68 65 20 2d 49 20 |just use| the -I |
|00004d60| 49 4e 43 4c 55 44 45 44 | 49 52 20 64 69 72 65 63 |INCLUDED|IR direc|
|00004d70| 74 69 76 65 20 66 6f 72 | 20 74 68 65 0a 58 09 20 |tive for| the.X. |
|00004d80| 20 63 6f 6d 70 69 6c 65 | 72 20 74 6f 20 70 6f 69 | compile|r to poi|
|00004d90| 6e 74 20 74 68 65 09 63 | 6f 6d 70 69 6c 65 72 20 |nt the.c|ompiler |
|00004da0| 74 6f 20 74 68 65 09 64 | 65 62 75 67 67 69 6e 67 |to the.d|ebugging|
|00004db0| 20 76 65 72 73 69 6f 6e | 20 6f 66 0a 58 09 20 20 | version| of.X. |
|00004dc0| 74 68 65 20 68 65 61 64 | 65 72 20 66 69 6c 65 20 |the head|er file |
|00004dd0| 69 6e 73 74 65 61 64 20 | 6f 66 20 74 68 65 20 6e |instead |of the n|
|00004de0| 6f 72 6d 61 6c 09 66 69 | 6c 65 2e 20 20 54 68 61 |ormal.fi|le. Tha|
|00004df0| 74 20 77 61 79 09 79 6f | 75 0a 58 09 20 20 64 6f |t way.yo|u.X. do|
|00004e00| 6e 27 74 09 68 61 76 65 | 20 74 6f 09 63 68 61 6e |n't.have| to.chan|
|00004e10| 67 65 20 74 68 65 20 73 | 6f 75 72 63 65 20 66 69 |ge the s|ource fi|
|00004e20| 6c 65 73 09 77 68 65 6e | 20 79 6f 75 20 77 61 6e |les.when| you wan|
|00004e30| 74 20 74 6f 20 74 75 72 | 6e 0a 58 09 20 20 6f 66 |t to tur|n.X. of|
|00004e40| 66 20 74 68 65 20 64 65 | 62 75 67 67 69 6e 67 20 |f the de|bugging |
|00004e50| 6c 69 62 72 61 72 79 2e | 0a 58 0a 58 09 20 20 4e |library.|.X.X. N|
|00004e60| 4f 54 45 3a 09 4f 6e 63 | 65 20 79 6f 75 20 63 6f |OTE:.Onc|e you co|
|00004e70| 6d 70 69 6c 65 20 63 6f | 64 65 20 69 6e 20 74 68 |mpile co|de in th|
|00004e80| 69 73 20 6d 6f 64 65 2c | 20 79 6f 75 09 6d 75 73 |is mode,| you.mus|
|00004e90| 74 20 72 65 63 6f 6d 70 | 69 6c 65 0a 58 09 20 20 |t recomp|ile.X. |
|00004ea0| 74 68 65 20 63 6f 64 65 | 20 77 69 74 68 6f 75 74 |the code| without|
|00004eb0| 20 74 68 65 20 64 65 62 | 75 67 67 69 6e 67 20 6d | the deb|ugging m|
|00004ec0| 61 6c 6c 6f 63 2e 68 20 | 69 6e 63 6c 75 64 65 20 |alloc.h |include |
|00004ed0| 66 69 6c 65 20 69 6e 0a | 58 09 20 20 6f 72 64 65 |file in.|X. orde|
|00004ee0| 72 09 74 6f 20 67 65 74 | 20 74 68 65 20 73 6f 66 |r.to get| the sof|
|00004ef0| 74 77 61 72 65 20 74 6f | 20 75 73 65 20 74 68 65 |tware to| use the|
|00004f00| 20 6e 6f 6e 2d 64 65 62 | 75 67 67 69 6e 67 0a 58 | non-deb|ugging.X|
|00004f10| 09 20 20 66 75 6e 63 74 | 69 6f 6e 73 2e 0a 58 0a |. funct|ions..X.|
|00004f20| 58 09 20 20 4d 4f 44 45 | 20 33 20 2d 20 72 75 6e |X. MODE| 3 - run|
|00004f30| 2d 74 69 6d 65 20 73 70 | 65 63 69 66 69 63 61 74 |-time sp|ecificat|
|00004f40| 69 6f 6e 20 6f 66 20 6f | 70 74 69 6f 6e 73 0a 58 |ion of o|ptions.X|
|00004f50| 0a 58 09 20 20 45 6e 76 | 69 72 6f 6e 6d 65 6e 74 |.X. Env|ironment|
|00004f60| 20 76 61 72 69 61 62 6c | 65 73 09 63 61 6e 20 62 | variabl|es.can b|
|00004f70| 65 20 75 73 65 64 20 74 | 6f 20 63 6f 6e 74 72 6f |e used t|o contro|
|00004f80| 6c 20 74 68 65 20 62 65 | 68 61 76 69 6f 72 20 6f |l the be|havior o|
|00004f90| 66 0a 58 09 20 20 74 68 | 65 20 64 65 62 75 67 67 |f.X. th|e debugg|
|00004fa0| 69 6e 67 09 6c 69 62 72 | 61 72 79 09 74 6f 20 73 |ing.libr|ary.to s|
|00004fb0| 6f 6d 65 09 65 78 74 65 | 6e 74 2e 09 20 48 6f 77 |ome.exte|nt.. How|
|00004fc0| 65 76 65 72 2c 20 74 68 | 69 73 20 63 6f 6e 74 72 |ever, th|is contr|
|00004fd0| 6f 6c 0a 58 09 20 20 69 | 73 20 76 65 72 79 20 63 |ol.X. i|s very c|
|00004fe0| 6f 61 72 73 65 20 69 6e | 20 74 68 61 74 20 79 6f |oarse in| that yo|
|00004ff0| 75 20 6f 6e 6c 79 20 68 | 61 76 65 20 6f 6e 65 20 |u only h|ave one |
|00005000| 73 65 74 74 69 6e 67 20 | 61 76 61 69 6c 61 62 6c |setting |availabl|
|00005010| 65 0a 58 09 20 20 66 6f | 72 20 74 68 65 20 65 6e |e.X. fo|r the en|
|00005020| 74 69 72 65 20 72 75 6e | 6e 69 6e 67 20 6f 66 20 |tire run|ning of |
|00005030| 74 68 65 09 70 72 6f 67 | 72 61 6d 2e 0a 58 0a 58 |the.prog|ram..X.X|
|00005040| 09 20 20 54 68 69 73 20 | 63 61 6e 20 62 65 20 61 |. This |can be a|
|00005050| 09 70 72 6f 62 6c 65 6d | 09 69 66 20 79 6f 75 20 |.problem|.if you |
|00005060| 77 61 6e 74 20 74 6f 20 | 74 75 72 6e 20 6f 6e 20 |want to |turn on |
|00005070| 6d 61 6c 6c 6f 63 20 63 | 68 61 69 6e 0a 58 09 20 |malloc c|hain.X. |
|00005080| 20 63 68 65 63 6b 69 6e | 67 2c 20 62 75 74 09 6b | checkin|g, but.k|
|00005090| 6e 6f 77 20 74 68 61 74 | 20 74 68 65 20 70 72 6f |now that| the pro|
|000050a0| 62 6c 65 6d 20 6f 63 63 | 75 72 73 20 62 65 74 77 |blem occ|urs betw|
|000050b0| 65 65 6e 20 61 0a 58 09 | 20 20 72 65 6c 61 74 69 |een a.X.| relati|
|000050c0| 76 65 6c 79 20 6e 61 72 | 72 6f 77 20 70 6f 72 74 |vely nar|row port|
|000050d0| 69 6f 6e 20 6f 66 20 74 | 68 65 20 63 6f 64 65 09 |ion of t|he code.|
|000050e0| 61 6e 64 20 64 6f 6e 27 | 74 20 77 61 6e 74 20 74 |and don'|t want t|
|000050f0| 6f 20 74 61 6b 65 0a 58 | 09 20 20 74 68 65 20 68 |o take.X|. the h|
|00005100| 69 74 20 6f 66 20 68 61 | 76 69 6e 67 20 63 68 61 |it of ha|ving cha|
|00005110| 69 6e 20 63 68 65 63 6b | 69 6e 67 20 6f 6e 20 66 |in check|ing on f|
|00005120| 6f 72 20 74 68 65 20 65 | 6e 74 69 72 65 20 70 72 |or the e|ntire pr|
|00005130| 6f 67 72 61 6d 0a 58 09 | 20 20 65 78 65 63 75 74 |ogram.X.| execut|
|00005140| 69 6f 6e 2e 0a 58 0a 58 | 09 20 20 54 68 65 20 73 |ion..X.X|. The s|
|00005150| 6f 6c 75 74 69 6f 6e 20 | 74 6f 20 74 68 69 73 20 |olution |to this |
|00005160| 70 72 6f 62 6c 65 6d 20 | 69 73 20 74 6f 20 69 6e |problem |is to in|
|00005170| 63 6c 75 64 65 20 63 61 | 6c 6c 73 20 74 6f 0a 58 |clude ca|lls to.X|
|00005180| 09 20 20 64 62 6d 61 6c | 6c 6f 70 74 28 29 20 77 |. dbmal|lopt() w|
|00005190| 69 74 68 20 74 68 65 20 | 64 65 62 75 67 67 69 6e |ith the |debuggin|
|000051a0| 67 20 6f 70 74 69 6f 6e | 73 20 77 68 69 63 68 20 |g option|s which |
|000051b0| 73 65 74 20 74 68 65 0a | 58 09 20 20 61 70 70 72 |set the.|X. appr|
|000051c0| 6f 70 72 69 61 74 65 20 | 6d 6f 64 65 73 20 77 68 |opriate |modes wh|
|000051d0| 65 6e 20 79 6f 75 20 77 | 61 6e 74 20 74 68 65 6d |en you w|ant them|
|000051e0| 20 73 65 74 2e 20 20 53 | 69 6e 63 65 20 79 6f 75 | set. S|ince you|
|000051f0| 20 64 6f 6e 27 74 0a 58 | 09 20 20 77 61 6e 74 20 | don't.X|. want |
|00005200| 74 6f 20 68 61 76 65 20 | 74 6f 20 63 68 61 6e 67 |to have |to chang|
|00005210| 65 20 74 68 65 20 63 6f | 64 65 20 74 6f 20 72 65 |e the co|de to re|
|00005220| 6d 6f 76 65 20 61 6e 64 | 09 61 64 64 20 74 68 65 |move and|.add the|
|00005230| 73 65 0a 58 09 20 20 66 | 75 6e 63 74 69 6f 6e 73 |se.X. f|unctions|
|00005240| 20 65 76 65 72 79 20 74 | 69 6d 65 20 79 6f 75 20 | every t|ime you |
|00005250| 64 65 63 69 64 65 20 74 | 6f 20 69 6e 63 6c 75 64 |decide t|o includ|
|00005260| 65 20 6d 61 6c 6c 6f 63 | 20 64 65 62 75 67 67 69 |e malloc| debuggi|
|00005270| 6e 67 0a 58 09 20 20 6f | 72 20 6e 6f 74 2c 20 74 |ng.X. o|r not, t|
|00005280| 68 65 20 6d 61 6c 6c 6f | 63 2e 68 20 66 69 6c 65 |he mallo|c.h file|
|00005290| 20 64 65 66 69 6e 65 73 | 20 74 68 65 09 70 72 65 | defines| the.pre|
|000052a0| 70 72 6f 63 65 73 73 6f | 72 20 73 79 6d 62 6f 6c |processo|r symbol|
|000052b0| 0a 58 09 20 20 5f 44 45 | 42 55 47 5f 4d 41 4c 4c |.X. _DE|BUG_MALL|
|000052c0| 4f 43 5f 49 4e 43 20 77 | 68 69 63 68 20 63 61 6e |OC_INC w|hich can|
|000052d0| 20 62 65 20 75 73 65 64 | 20 69 6e 20 79 6f 75 72 | be used| in your|
|000052e0| 20 63 6f 64 65 20 61 73 | 20 66 6f 6c 6c 6f 77 73 | code as| follows|
|000052f0| 3a 0a 58 0a 58 09 20 20 | 20 20 20 20 20 23 69 66 |:.X.X. | #if|
|00005300| 64 65 66 20 5f 44 45 42 | 55 47 5f 4d 41 4c 4c 4f |def _DEB|UG_MALLO|
|00005310| 43 5f 49 4e 43 0a 58 09 | 09 20 20 20 20 64 62 6d |C_INC.X.|. dbm|
|00005320| 61 6c 6c 6f 70 74 28 2e | 2e 2e 2e 20 29 3b 0a 58 |allopt(.|... );.X|
|00005330| 09 20 20 20 20 20 20 20 | 23 65 6e 64 69 66 0a 58 |. |#endif.X|
|00005340| 0a 58 09 20 20 49 6e 20 | 61 64 64 69 74 69 6f 6e |.X. In |addition|
|00005350| 20 74 6f 20 73 65 74 74 | 69 6e 67 20 62 65 68 61 | to sett|ing beha|
|00005360| 76 69 6f 72 20 6f 70 74 | 69 6f 6e 73 2c 20 79 6f |vior opt|ions, yo|
|00005370| 75 20 6d 69 67 68 74 20 | 77 61 6e 74 20 74 6f 0a |u might |want to.|
|00005380| 58 09 20 20 6d 61 6b 65 | 20 75 73 65 20 6f 66 20 |X. make| use of |
|00005390| 74 68 65 20 6d 65 6d 6f | 72 79 20 6c 65 61 6b 20 |the memo|ry leak |
|000053a0| 64 65 74 65 63 74 69 6f | 6e 09 72 6f 75 74 69 6e |detectio|n.routin|
|000053b0| 65 73 20 69 6e 20 74 68 | 69 73 20 6d 6f 64 65 2e |es in th|is mode.|
|000053c0| 0a 58 09 20 20 54 68 65 | 73 65 09 63 61 6c 6c 73 |.X. The|se.calls|
|000053d0| 20 73 68 6f 75 6c 64 20 | 61 6c 73 6f 20 62 65 20 | should |also be |
|000053e0| 73 75 72 72 6f 75 6e 64 | 65 64 09 62 79 20 23 69 |surround|ed.by #i|
|000053f0| 66 64 65 66 73 20 66 6f | 72 20 74 68 65 0a 58 09 |fdefs fo|r the.X.|
|00005400| 20 20 64 65 62 75 67 09 | 6d 61 6c 6c 6f 63 20 73 | debug.|malloc s|
|00005410| 79 6d 62 6f 6c 20 73 6f | 20 74 68 61 74 20 79 6f |ymbol so| that yo|
|00005420| 75 20 63 61 6e 20 6c 65 | 61 76 65 20 74 68 65 6d |u can le|ave them|
|00005430| 20 69 6e 20 74 68 65 09 | 63 6f 64 65 0a 58 09 20 | in the.|code.X. |
|00005440| 20 61 6e 64 20 61 75 74 | 6f 6d 61 74 69 63 61 6c | and aut|omatical|
|00005450| 6c 79 20 67 65 74 09 74 | 68 65 20 69 6e 63 72 65 |ly get.t|he incre|
|00005460| 61 73 65 64 20 66 75 6e | 63 74 69 6f 6e 61 6c 69 |ased fun|ctionali|
|00005470| 74 79 20 77 68 65 6e 65 | 76 65 72 0a 58 09 20 20 |ty whene|ver.X. |
|00005480| 79 6f 75 20 63 6f 6d 70 | 69 6c 65 20 77 69 74 68 |you comp|ile with|
|00005490| 20 74 68 65 20 64 65 62 | 75 67 67 69 6e 67 20 6c | the deb|ugging l|
|000054a0| 69 62 72 61 72 79 2e 0a | 58 0a 58 0a 58 0a 58 20 |ibrary..|X.X.X.X |
|000054b0| 20 20 20 20 50 61 67 65 | 20 31 30 09 09 09 20 20 | Page| 10... |
|000054c0| 20 31 2e 31 31 0a 58 0a | 58 0a 58 0a 58 0a 58 0a | 1.11.X.|X.X.X.X.|
|000054d0| 58 0a 58 20 20 20 20 20 | 44 45 42 55 47 5f 4d 41 |X.X |DEBUG_MA|
|000054e0| 4c 4c 4f 43 28 33 29 09 | 09 20 20 20 28 56 54 49 |LLOC(3).|. (VTI|
|000054f0| 29 09 20 20 20 20 20 20 | 20 44 45 42 55 47 5f 4d |). | DEBUG_M|
|00005500| 41 4c 4c 4f 43 28 33 29 | 0a 58 0a 58 0a 58 0a 58 |ALLOC(3)|.X.X.X.X|
|00005510| 09 20 20 4d 4f 44 45 20 | 34 20 2d 20 64 65 65 70 |. MODE |4 - deep|
|00005520| 65 72 20 69 6e 63 6c 75 | 73 69 6f 6e 20 6f 66 20 |er inclu|sion of |
|00005530| 6d 61 6c 6c 6f 63 20 63 | 61 6c 6c 73 0a 58 0a 58 |malloc c|alls.X.X|
|00005540| 09 20 20 54 68 69 73 20 | 6d 6f 64 65 20 69 6e 76 |. This |mode inv|
|00005550| 6f 6c 76 65 73 20 69 6e | 73 65 72 74 69 6e 67 20 |olves in|serting |
|00005560| 63 61 6c 6c 73 20 74 6f | 09 74 68 65 20 73 70 65 |calls to|.the spe|
|00005570| 63 69 61 6c 20 66 75 6e | 63 74 69 6f 6e 73 0a 58 |cial fun|ctions.X|
|00005580| 09 20 20 73 75 70 70 6f | 72 74 65 64 20 62 79 20 |. suppo|rted by |
|00005590| 74 68 65 20 6d 61 6c 6c | 6f 63 20 6c 69 62 72 61 |the mall|oc libra|
|000055a0| 72 79 20 28 6c 69 6b 65 | 09 74 68 65 20 6c 65 61 |ry (like|.the lea|
|000055b0| 6b 20 64 65 74 65 63 74 | 69 6f 6e 20 6f 72 0a 58 |k detect|ion or.X|
|000055c0| 09 20 20 73 74 61 63 6b | 09 6d 61 69 6e 74 65 6e |. stack|.mainten|
|000055d0| 61 6e 63 65 20 72 6f 75 | 74 69 6e 65 73 29 2e 09 |ance rou|tines)..|
|000055e0| 54 68 65 20 65 66 66 65 | 63 74 73 20 6f 66 20 74 |The effe|cts of t|
|000055f0| 68 65 20 69 6e 63 6c 75 | 73 69 6f 6e 73 0a 58 09 |he inclu|sions.X.|
|00005600| 20 20 64 65 70 65 6e 64 | 73 20 75 70 6f 6e 20 74 | depend|s upon t|
|00005610| 68 65 20 6d 6f 64 75 6c | 65 73 20 69 6e 63 6c 75 |he modul|es inclu|
|00005620| 64 65 64 20 61 6e 64 09 | 74 68 65 20 61 6d 6f 75 |ded and.|the amou|
|00005630| 6e 74 20 74 6f 20 77 68 | 69 63 68 0a 58 09 20 20 |nt to wh|ich.X. |
|00005640| 74 68 65 79 20 61 72 65 | 20 75 73 65 64 2e 0a 58 |they are| used..X|
|00005650| 0a 58 09 20 20 49 74 20 | 69 73 09 73 74 72 6f 6e |.X. It |is.stron|
|00005660| 67 6c 79 20 72 65 63 6f | 6d 6d 65 6e 64 65 64 20 |gly reco|mmended |
|00005670| 74 68 61 74 20 79 6f 75 | 20 73 65 74 75 70 20 79 |that you| setup y|
|00005680| 6f 75 72 20 63 6f 64 65 | 20 77 69 74 68 20 74 68 |our code| with th|
|00005690| 65 0a 58 09 20 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |e.X. fo|llowing |
|000056a0| 6c 69 6e 65 73 20 69 6e | 20 61 20 68 65 61 64 65 |lines in| a heade|
|000056b0| 72 20 66 69 6c 65 20 74 | 68 61 74 09 69 73 20 69 |r file t|hat.is i|
|000056c0| 6e 63 6c 75 64 65 64 20 | 62 79 20 61 6c 6c 0a 58 |ncluded |by all.X|
|000056d0| 09 20 20 6d 6f 64 75 6c | 65 73 2c 20 6f 72 20 6a |. modul|es, or j|
|000056e0| 75 73 74 20 61 64 64 20 | 74 68 65 20 63 6f 64 65 |ust add |the code|
|000056f0| 09 74 6f 20 74 68 65 20 | 62 65 67 69 6e 6e 69 6e |.to the |beginnin|
|00005700| 67 20 6f 66 20 74 68 65 | 0a 58 09 20 20 6d 6f 64 |g of the|.X. mod|
|00005710| 75 6c 65 73 20 74 68 65 | 6d 73 65 6c 76 65 73 3a |ules the|mselves:|
|00005720| 0a 58 0a 58 09 20 20 20 | 20 20 20 20 23 69 66 6e |.X.X. | #ifn|
|00005730| 64 65 66 20 5f 44 45 42 | 55 47 5f 4d 41 4c 4c 4f |def _DEB|UG_MALLO|
|00005740| 43 5f 49 4e 43 0a 58 09 | 20 20 20 20 20 20 20 23 |C_INC.X.| #|
|00005750| 64 65 66 69 6e 65 20 6d | 61 6c 6c 6f 63 5f 65 6e |define m|alloc_en|
|00005760| 74 65 72 28 66 75 6e 63 | 29 0a 58 09 20 20 20 20 |ter(func|).X. |
|00005770| 20 20 20 23 64 65 66 69 | 6e 65 20 6d 61 6c 6c 6f | #defi|ne mallo|
|00005780| 63 5f 6c 65 61 76 65 28 | 66 75 6e 63 29 0a 58 09 |c_leave(|func).X.|
|00005790| 20 20 20 20 20 20 20 23 | 64 65 66 69 6e 65 20 6d | #|define m|
|000057a0| 61 6c 6c 6f 63 5f 63 68 | 61 69 6e 5f 63 68 65 63 |alloc_ch|ain_chec|
|000057b0| 6b 28 29 0a 58 09 20 20 | 20 20 20 20 20 23 64 65 |k().X. | #de|
|000057c0| 66 69 6e 65 20 6d 61 6c | 6c 6f 63 5f 64 75 6d 70 |fine mal|loc_dump|
|000057d0| 28 66 64 29 0a 58 09 20 | 20 20 20 20 20 20 23 64 |(fd).X. | #d|
|000057e0| 65 66 69 6e 65 20 6d 61 | 6c 6c 6f 63 5f 6c 69 73 |efine ma|lloc_lis|
|000057f0| 74 28 61 2c 62 2c 63 29 | 0a 58 09 20 20 20 20 20 |t(a,b,c)|.X. |
|00005800| 20 20 23 64 65 66 69 6e | 65 20 6d 61 6c 6c 6f 63 | #defin|e malloc|
|00005810| 5f 69 6e 75 73 65 28 68 | 69 73 74 29 20 20 20 20 |_inuse(h|ist) |
|00005820| 28 2a 28 68 69 73 74 29 | 20 3d 09 30 2c 20 30 29 |(*(hist)| =.0, 0)|
|00005830| 0a 58 09 20 20 20 20 20 | 20 20 23 65 6e 64 69 66 |.X. | #endif|
|00005840| 0a 58 0a 58 09 20 20 54 | 68 69 73 20 77 69 6c 6c |.X.X. T|his will|
|00005850| 20 61 75 74 6f 6d 61 74 | 69 63 61 6c 6c 79 20 64 | automat|ically d|
|00005860| 69 73 61 62 6c 65 20 74 | 68 65 20 72 65 66 65 72 |isable t|he refer|
|00005870| 65 6e 63 65 64 20 66 75 | 6e 63 74 69 6f 6e 73 0a |enced fu|nctions.|
|00005880| 58 09 20 20 77 68 65 6e | 20 74 68 65 20 6d 61 6c |X. when| the mal|
|00005890| 6c 6f 63 20 6c 69 62 72 | 61 72 79 20 69 73 20 6e |loc libr|ary is n|
|000058a0| 6f 74 20 69 6e 63 6c 75 | 64 65 64 20 28 61 73 20 |ot inclu|ded (as |
|000058b0| 73 68 6f 75 6c 64 20 62 | 65 09 74 68 65 0a 58 09 |should b|e.the.X.|
|000058c0| 20 20 63 61 73 65 20 77 | 68 65 6e 20 79 6f 75 09 | case w|hen you.|
|000058d0| 6d 61 6b 65 20 61 20 70 | 72 6f 64 75 63 74 69 6f |make a p|roductio|
|000058e0| 6e 20 62 75 69 6c 64 29 | 2e 0a 58 0a 58 20 20 20 |n build)|..X.X |
|000058f0| 20 20 45 4e 56 49 52 4f | 4e 4d 45 4e 54 20 56 41 | ENVIRO|NMENT VA|
|00005900| 52 49 41 42 4c 45 53 0a | 58 09 20 20 45 6e 76 69 |RIABLES.|X. Envi|
|00005910| 72 6f 6e 6d 65 6e 74 20 | 76 61 72 69 61 62 6c 65 |ronment |variable|
|00005920| 73 09 63 61 6e 20 62 65 | 20 75 73 65 64 20 74 6f |s.can be| used to|
|00005930| 20 63 6f 6e 74 72 6f 6c | 20 65 72 72 6f 72 20 68 | control| error h|
|00005940| 61 6e 64 6c 69 6e 67 2c | 0a 58 09 20 20 65 72 72 |andling,|.X. err|
|00005950| 6f 72 09 6c 6f 67 67 69 | 6e 67 09 61 6e 64 20 6d |or.loggi|ng.and m|
|00005960| 61 6c 6c 6f 63 20 63 68 | 61 69 6e 20 63 68 65 63 |alloc ch|ain chec|
|00005970| 6b 69 6e 67 20 61 74 20 | 72 75 6e 20 74 69 6d 65 |king at |run time|
|00005980| 2e 09 4d 6f 73 74 0a 58 | 09 20 20 6f 66 20 74 68 |..Most.X|. of th|
|00005990| 65 73 65 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 20 |ese envi|ronment |
|000059a0| 76 61 72 69 61 62 6c 65 | 73 20 63 61 6e 20 62 65 |variable|s can be|
|000059b0| 09 73 65 74 20 76 69 61 | 09 74 68 65 0a 58 09 20 |.set via|.the.X. |
|000059c0| 20 64 62 6d 61 6c 6c 6f | 70 74 28 29 20 72 6f 75 | dbmallo|pt() rou|
|000059d0| 74 69 6e 65 20 61 6e 64 | 20 61 72 65 20 77 65 6c |tine and| are wel|
|000059e0| 6c 20 64 65 73 63 72 69 | 62 65 64 20 69 6e 09 74 |l descri|bed in.t|
|000059f0| 68 61 74 20 70 6f 72 74 | 69 6f 6e 0a 58 09 20 20 |hat port|ion.X. |
|00005a00| 6f 66 20 74 68 65 20 64 | 6f 63 75 6d 65 6e 74 2e |of the d|ocument.|
|00005a10| 20 20 4c 6f 6f 6b 20 66 | 6f 72 20 66 75 72 74 68 | Look f|or furth|
|00005a20| 65 72 20 69 6e 66 6f 72 | 6d 61 74 69 6f 6e 20 74 |er infor|mation t|
|00005a30| 68 65 72 65 2e 0a 58 0a | 58 09 20 20 54 68 65 20 |here..X.|X. The |
|00005a40| 66 6f 6c 6c 6f 77 69 6e | 67 09 65 6e 76 69 72 6f |followin|g.enviro|
|00005a50| 6e 6d 65 6e 74 20 76 61 | 72 69 61 62 6c 65 73 20 |nment va|riables |
|00005a60| 61 72 65 20 75 73 65 64 | 3a 0a 58 0a 58 09 20 20 |are used|:.X.X. |
|00005a70| 4d 41 4c 4c 4f 43 5f 42 | 4f 55 4e 44 53 49 5a 45 |MALLOC_B|OUNDSIZE|
|00005a80| 20 20 20 20 54 68 69 73 | 20 73 70 65 63 69 66 69 | This| specifi|
|00005a90| 65 73 20 74 68 65 20 6d | 69 6e 69 6d 75 6d 20 6e |es the m|inimum n|
|00005aa0| 75 6d 62 65 72 09 6f 66 | 0a 58 09 09 09 20 20 20 |umber.of|.X... |
|00005ab0| 20 20 20 62 79 74 65 73 | 20 74 68 61 74 20 74 68 | bytes| that th|
|00005ac0| 65 20 61 6c 6c 6f 63 61 | 74 69 6f 6e 09 72 6f 75 |e alloca|tion.rou|
|00005ad0| 74 69 6e 65 73 20 77 69 | 6c 6c 0a 58 09 09 09 20 |tines wi|ll.X... |
|00005ae0| 20 20 20 20 20 6c 65 61 | 76 65 20 75 6e 75 73 65 | lea|ve unuse|
|00005af0| 64 20 61 74 20 74 68 65 | 20 65 6e 64 20 6f 66 20 |d at the| end of |
|00005b00| 65 61 63 68 20 73 65 67 | 6d 65 6e 74 2e 0a 58 09 |each seg|ment..X.|
|00005b10| 09 09 20 20 20 20 20 20 | 54 68 69 73 20 76 61 6c |.. |This val|
|00005b20| 75 65 20 6d 61 79 20 62 | 65 09 61 6e 79 20 6e 6f |ue may b|e.any no|
|00005b30| 6e 2d 7a 65 72 6f 20 70 | 6f 73 69 74 69 76 65 0a |n-zero p|ositive.|
|00005b40| 58 09 09 09 20 20 20 20 | 20 20 69 6e 74 65 67 65 |X... | intege|
|00005b50| 72 20 28 61 6c 74 68 6f | 75 67 68 09 79 6f 75 20 |r (altho|ugh.you |
|00005b60| 6d 75 73 74 20 72 65 6d | 65 6d 62 65 72 20 74 68 |must rem|ember th|
|00005b70| 61 74 0a 58 09 09 09 20 | 20 20 20 20 20 74 68 65 |at.X... | the|
|00005b80| 20 61 6d 6f 75 6e 74 20 | 6f 66 20 6d 65 6d 6f 72 | amount |of memor|
|00005b90| 79 20 75 73 65 64 09 69 | 73 20 64 69 72 65 63 74 |y used.i|s direct|
|00005ba0| 6c 79 0a 58 09 09 09 20 | 20 20 20 20 20 72 65 6c |ly.X... | rel|
|00005bb0| 61 74 65 64 20 74 6f 20 | 74 68 69 73 20 62 75 66 |ated to |this buf|
|00005bc0| 66 65 72 20 61 72 65 61 | 2e 0a 58 0a 58 09 09 09 |fer area|..X.X...|
|00005bd0| 20 20 20 20 20 20 49 74 | 20 6d 61 79 20 62 65 09 | It| may be.|
|00005be0| 6e 65 63 65 73 73 61 72 | 79 20 74 6f 20 69 6e 63 |necessar|y to inc|
|00005bf0| 72 65 61 73 65 20 74 68 | 69 73 0a 58 09 09 09 20 |rease th|is.X... |
|00005c00| 20 20 20 20 20 76 61 6c | 75 65 20 69 66 20 79 6f | val|ue if yo|
|00005c10| 75 20 74 68 69 6e 6b 20 | 79 6f 75 20 68 61 76 65 |u think |you have|
|00005c20| 20 61 20 6d 6f 64 75 6c | 65 0a 58 09 09 09 20 20 | a modul|e.X... |
|00005c30| 20 20 20 20 74 68 61 74 | 20 69 73 20 77 72 69 74 | that| is writ|
|00005c40| 69 6e 67 20 66 61 72 20 | 65 6e 6f 75 67 68 20 62 |ing far |enough b|
|00005c50| 65 79 6f 6e 64 09 69 74 | 73 0a 58 09 09 09 20 20 |eyond.it|s.X... |
|00005c60| 20 20 20 20 6d 61 6c 6c | 6f 63 20 73 65 67 6d 65 | mall|oc segme|
|00005c70| 6e 74 20 74 68 61 74 20 | 69 74 20 63 68 61 6e 67 |nt that |it chang|
|00005c80| 65 73 20 74 68 65 20 6e | 65 78 74 0a 58 09 09 09 |es the n|ext.X...|
|00005c90| 20 20 20 20 20 20 73 65 | 67 6d 65 6e 74 20 28 61 | se|gment (a|
|00005ca0| 6e 64 20 74 68 65 72 65 | 66 6f 72 65 20 64 6f 65 |nd there|fore doe|
|00005cb0| 73 6e 27 74 20 6d 61 6b | 65 20 61 0a 58 09 09 09 |sn't mak|e a.X...|
|00005cc0| 20 20 20 20 20 20 63 68 | 61 6e 67 65 20 74 68 61 | ch|ange tha|
|00005cd0| 74 20 74 68 69 73 20 6c | 69 62 72 61 72 79 20 77 |t this l|ibrary w|
|00005ce0| 6f 75 6c 64 20 62 65 09 | 61 62 6c 65 0a 58 09 09 |ould be.|able.X..|
|00005cf0| 09 20 20 20 20 20 20 74 | 6f 20 64 65 74 65 63 74 |. t|o detect|
|00005d00| 2e 0a 58 0a 58 09 09 09 | 20 20 20 20 20 20 54 68 |..X.X...| Th|
|00005d10| 65 20 64 65 66 61 75 6c | 74 20 66 6f 72 20 74 68 |e defaul|t for th|
|00005d20| 69 73 20 76 61 6c 75 65 | 20 69 73 20 31 0a 58 0a |is value| is 1.X.|
|00005d30| 58 0a 58 0a 58 20 20 20 | 20 20 50 61 67 65 20 31 |X.X.X | Page 1|
|00005d40| 31 09 09 09 20 20 20 31 | 2e 31 31 0a 58 0a 58 0a |1... 1|.11.X.X.|
|00005d50| 58 0a 58 0a 58 0a 58 0a | 58 20 20 20 20 20 44 45 |X.X.X.X.|X DE|
|00005d60| 42 55 47 5f 4d 41 4c 4c | 4f 43 28 33 29 09 09 20 |BUG_MALL|OC(3).. |
|00005d70| 20 20 28 56 54 49 29 09 | 20 20 20 20 20 20 20 44 | (VTI).| D|
|00005d80| 45 42 55 47 5f 4d 41 4c | 4c 4f 43 28 33 29 0a 58 |EBUG_MAL|LOC(3).X|
|00005d90| 0a 58 0a 58 0a 58 09 09 | 09 20 20 20 20 20 20 28 |.X.X.X..|. (|
|00005da0| 61 6c 74 68 6f 75 67 68 | 09 62 65 63 61 75 73 65 |although|.because|
|00005db0| 09 6f 66 20 6d 65 6d 6f | 72 79 20 61 6c 69 67 6e |.of memo|ry align|
|00005dc0| 6d 65 6e 74 0a 58 09 09 | 09 20 20 20 20 20 20 69 |ment.X..|. i|
|00005dd0| 73 73 75 65 73 2c 20 79 | 6f 75 20 77 69 6c 6c 20 |ssues, y|ou will |
|00005de0| 75 73 75 61 6c 6c 79 20 | 68 61 76 65 20 6d 6f 72 |usually |have mor|
|00005df0| 65 20 74 68 61 6e 0a 58 | 09 09 09 20 20 20 20 20 |e than.X|... |
|00005e00| 20 6f 6e 65 20 62 79 74 | 65 20 6f 66 20 66 69 6c | one byt|e of fil|
|00005e10| 6c 65 72 20 61 74 20 74 | 68 65 09 65 6e 64 20 6f |ler at t|he.end o|
|00005e20| 66 20 6d 6f 73 74 0a 58 | 09 09 09 20 20 20 20 20 |f most.X|... |
|00005e30| 20 73 65 67 6d 65 6e 74 | 73 29 2e 0a 58 09 20 20 | segment|s)..X. |
|00005e40| 4d 41 4c 4c 4f 43 5f 43 | 4b 43 48 41 49 4e 20 20 |MALLOC_C|KCHAIN |
|00005e50| 20 20 20 20 69 66 20 31 | 2c 20 74 75 72 6e 73 20 | if 1|, turns |
|00005e60| 6f 6e 20 6d 61 6c 6c 6f | 63 20 63 68 61 69 6e 20 |on mallo|c chain |
|00005e70| 63 68 65 63 6b 69 6e 67 | 20 61 74 0a 58 09 09 09 |checking| at.X...|
|00005e80| 20 20 20 20 20 20 65 76 | 65 72 79 20 63 61 6c 6c | ev|ery call|
|00005e90| 20 74 6f 20 61 6e 79 09 | 6f 66 20 74 68 65 20 6d | to any.|of the m|
|00005ea0| 61 6c 6c 6f 63 0a 58 09 | 09 09 20 20 20 20 20 20 |alloc.X.|.. |
|00005eb0| 66 75 6e 63 74 69 6f 6e | 73 2e 0a 58 09 20 20 4d |function|s..X. M|
|00005ec0| 41 4c 4c 4f 43 5f 44 45 | 54 41 49 4c 09 20 20 20 |ALLOC_DE|TAIL. |
|00005ed0| 20 20 20 69 66 20 73 65 | 74 20 74 6f 09 61 20 6e | if se|t to.a n|
|00005ee0| 6f 6e 2d 7a 65 72 6f 20 | 69 6e 74 65 67 65 72 2c |on-zero |integer,|
|00005ef0| 0a 58 09 09 09 20 20 20 | 20 20 20 6d 61 6c 6c 6f |.X... | mallo|
|00005f00| 63 5f 64 75 6d 70 20 73 | 68 6f 77 73 09 73 6f 6d |c_dump s|hows.som|
|00005f10| 65 20 69 6e 74 65 72 6e | 61 6c 20 64 65 74 61 69 |e intern|al detai|
|00005f20| 6c 0a 58 09 09 09 20 20 | 20 20 20 20 66 6f 72 20 |l.X... | for |
|00005f30| 65 61 63 68 20 65 6e 74 | 72 79 20 69 6e 09 74 68 |each ent|ry in.th|
|00005f40| 65 20 63 68 61 69 6e 2e | 20 20 54 68 69 73 20 69 |e chain.| This i|
|00005f50| 6e 66 6f 0a 58 09 09 09 | 20 20 20 20 20 20 69 73 |nfo.X...| is|
|00005f60| 20 70 72 6f 62 61 62 6c | 79 20 6f 6e 6c 79 20 6f | probabl|y only o|
|00005f70| 66 20 75 73 65 20 69 66 | 20 79 6f 75 20 61 72 65 |f use if| you are|
|00005f80| 0a 58 09 09 09 20 20 20 | 20 20 20 64 65 62 75 67 |.X... | debug|
|00005f90| 67 69 6e 67 09 74 68 65 | 20 6d 61 6c 6c 6f 63 20 |ging.the| malloc |
|00005fa0| 6c 69 62 72 61 72 79 20 | 69 74 73 65 6c 66 2e 0a |library |itself..|
|00005fb0| 58 09 20 20 4d 41 4c 4c | 4f 43 5f 45 52 52 46 49 |X. MALL|OC_ERRFI|
|00005fc0| 4c 45 20 20 20 20 20 20 | 73 70 65 63 69 66 69 65 |LE |specifie|
|00005fd0| 73 09 74 68 65 20 65 72 | 72 6f 72 20 6c 6f 67 20 |s.the er|ror log |
|00005fe0| 66 69 6c 65 20 66 6f 72 | 20 65 72 72 6f 72 0a 58 |file for| error.X|
|00005ff0| 09 09 09 20 20 20 20 20 | 20 6d 65 73 73 61 67 65 |... | message|
|00006000| 73 2e 09 20 45 72 72 6f | 72 20 6d 65 73 73 61 67 |s.. Erro|r messag|
|00006010| 65 73 09 67 65 6e 65 72 | 61 74 65 64 20 62 79 0a |es.gener|ated by.|
|00006020| 58 09 09 09 20 20 20 20 | 20 20 74 68 65 20 6c 69 |X... | the li|
|00006030| 62 72 61 72 79 20 61 72 | 65 20 41 50 50 45 4e 44 |brary ar|e APPEND|
|00006040| 45 44 20 74 6f 20 74 68 | 69 73 20 66 69 6c 65 2c |ED to th|is file,|
|00006050| 0a 58 09 09 09 20 20 20 | 20 20 20 73 6f 20 69 66 |.X... | so if|
|00006060| 20 79 6f 75 09 77 61 6e | 74 20 61 20 63 6c 65 61 | you.wan|t a clea|
|00006070| 6e 20 66 69 6c 65 2c 20 | 79 6f 75 20 77 69 6c 6c |n file, |you will|
|00006080| 0a 58 09 09 09 20 20 20 | 20 20 20 68 61 76 65 20 |.X... | have |
|00006090| 74 6f 20 72 65 6d 6f 76 | 65 20 6f 72 09 65 6d 70 |to remov|e or.emp|
|000060a0| 74 79 20 69 74 20 79 6f | 75 72 73 65 6c 66 0a 58 |ty it yo|urself.X|
|000060b0| 09 09 09 20 20 20 20 20 | 20 62 65 74 77 65 65 6e |... | between|
|000060c0| 20 72 75 6e 73 2e 20 20 | 49 66 09 74 68 69 73 20 | runs. |If.this |
|000060d0| 6f 70 74 69 6f 6e 20 69 | 73 20 75 73 65 64 2c 0a |option i|s used,.|
|000060e0| 58 09 09 09 20 20 20 20 | 20 20 6e 6f 20 69 6e 64 |X... | no ind|
|000060f0| 69 63 61 74 69 6f 6e 20 | 6f 66 20 61 6e 20 65 72 |ication |of an er|
|00006100| 72 6f 72 09 77 69 6c 6c | 20 62 65 09 73 65 6e 74 |ror.will| be.sent|
|00006110| 0a 58 09 09 09 20 20 20 | 20 20 20 74 6f 20 73 74 |.X... | to st|
|00006120| 64 6f 75 74 09 6f 72 20 | 73 74 64 65 72 72 20 28 |dout.or |stderr (|
|00006130| 74 68 69 73 09 69 73 0a | 58 09 09 09 20 20 20 20 |this.is.|X... |
|00006140| 20 20 70 75 72 70 6f 73 | 65 66 75 6c 6c 79 20 64 | purpos|efully d|
|00006150| 6f 6e 65 09 74 68 69 73 | 20 77 61 79 20 73 6f 20 |one.this| way so |
|00006160| 74 68 61 74 20 69 66 0a | 58 09 09 09 20 20 20 20 |that if.|X... |
|00006170| 20 20 79 6f 75 20 61 72 | 65 20 72 75 6e 6e 69 6e | you ar|e runnin|
|00006180| 67 20 61 09 66 75 6c 6c | 20 73 63 72 65 65 6e 20 |g a.full| screen |
|00006190| 70 72 6f 67 72 61 6d 2c | 0a 58 09 09 09 20 20 20 |program,|.X... |
|000061a0| 20 20 20 69 74 20 64 6f | 65 73 6e 27 74 20 6d 65 | it do|esn't me|
|000061b0| 73 73 20 75 70 20 74 68 | 65 20 73 63 72 65 65 6e |ss up th|e screen|
|000061c0| 29 2e 0a 58 09 20 20 4d | 41 4c 4c 4f 43 5f 46 41 |)..X. M|ALLOC_FA|
|000061d0| 54 41 4c 09 20 20 20 20 | 20 20 73 70 65 63 69 66 |TAL. | specif|
|000061e0| 69 65 73 09 74 68 65 20 | 65 72 72 6f 72 20 68 61 |ies.the |error ha|
|000061f0| 6e 64 6c 69 6e 67 20 66 | 6f 72 20 66 61 74 61 6c |ndling f|or fatal|
|00006200| 0a 58 09 09 09 20 20 20 | 20 20 20 65 72 72 6f 72 |.X... | error|
|00006210| 73 0a 58 09 20 20 4d 41 | 4c 4c 4f 43 5f 46 49 4c |s.X. MA|LLOC_FIL|
|00006220| 4c 41 52 45 41 20 20 20 | 20 20 73 70 65 63 69 66 |LAREA | specif|
|00006230| 69 65 73 09 74 68 65 20 | 66 69 6c 6c 20 61 72 65 |ies.the |fill are|
|00006240| 61 20 66 6c 61 67 20 73 | 65 74 74 69 6e 67 2e 0a |a flag s|etting..|
|00006250| 58 09 09 09 20 20 20 20 | 20 20 49 66 20 7a 65 72 |X... | If zer|
|00006260| 6f 2c 20 6d 61 6c 6c 6f | 63 2f 66 72 65 65 20 61 |o, mallo|c/free a|
|00006270| 72 65 61 09 66 69 6c 6c | 69 6e 67 09 61 6e 64 0a |rea.fill|ing.and.|
|00006280| 58 09 09 09 20 20 20 20 | 20 20 63 68 65 63 6b 69 |X... | checki|
|00006290| 6e 67 20 69 73 20 64 69 | 73 61 62 6c 65 64 20 28 |ng is di|sabled (|
|000062a0| 74 68 65 72 65 62 79 20 | 69 6e 63 72 65 61 73 69 |thereby |increasi|
|000062b0| 6e 67 0a 58 09 09 09 20 | 20 20 20 20 20 70 65 72 |ng.X... | per|
|000062c0| 66 6f 72 6d 61 6e 63 65 | 2c 20 77 68 69 6c 65 20 |formance|, while |
|000062d0| 64 65 63 72 65 61 73 69 | 6e 67 0a 58 09 09 09 20 |decreasi|ng.X... |
|000062e0| 20 20 20 20 20 65 66 66 | 65 63 74 69 76 65 6e 65 | eff|ectivene|
|000062f0| 73 73 20 6f 66 20 74 68 | 65 20 6c 69 62 72 61 72 |ss of th|e librar|
|00006300| 79 29 2e 20 20 53 65 65 | 20 74 68 65 0a 58 09 09 |y). See| the.X..|
|00006310| 09 20 20 20 20 20 20 64 | 69 73 63 75 73 73 69 6f |. d|iscussio|
|00006320| 6e 20 6f 66 20 74 68 65 | 09 64 62 6d 61 6c 6c 6f |n of the|.dbmallo|
|00006330| 70 74 28 29 20 61 72 67 | 75 6d 65 6e 74 73 0a 58 |pt() arg|uments.X|
|00006340| 09 09 09 20 20 20 20 20 | 20 66 6f 72 20 6d 6f 72 |... | for mor|
|00006350| 65 20 69 6e 66 6f 20 6f | 6e 20 6f 74 68 65 72 20 |e info o|n other |
|00006360| 73 65 74 74 69 6e 67 73 | 2e 0a 58 09 20 20 4d 41 |settings|..X. MA|
|00006370| 4c 4c 4f 43 5f 46 49 4c | 4c 42 59 54 45 20 20 20 |LLOC_FIL|LBYTE |
|00006380| 20 20 54 68 69 73 20 73 | 70 65 63 69 66 69 65 73 | This s|pecifies|
|00006390| 20 74 68 65 20 69 6e 74 | 65 67 65 72 20 76 61 6c | the int|eger val|
|000063a0| 75 65 20 6f 66 20 74 68 | 65 0a 58 09 09 09 20 20 |ue of th|e.X... |
|000063b0| 20 20 20 20 63 68 61 72 | 61 63 74 65 72 09 74 6f | char|acter.to|
|000063c0| 20 75 73 65 20 77 68 65 | 6e 20 66 69 6c 6c 69 6e | use whe|n fillin|
|000063d0| 67 20 61 6c 6c 6f 63 61 | 74 65 64 0a 58 09 09 09 |g alloca|ted.X...|
|000063e0| 20 20 20 20 20 20 61 72 | 65 61 73 2e 20 20 54 68 | ar|eas. Th|
|000063f0| 69 73 20 76 61 6c 75 65 | 20 64 65 66 61 75 6c 74 |is value| default|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.