home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 January / macpower199701.bin / AMUG / Programming_10 / Videotoolbox 96-08-22-c.sit / VideoToolbox / VideoToolboxSources / MacMemory.h < prev    next >
MacBinary  |  1995-07-27  |  2.6 KB  |  [TEXT/CWIE]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: MacMemory.h

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Thu Jul 27 01:51:22 1995, modified Thu Jul 27 01:51:22 1995, creator 'CWIE', type ASCII, 1962 bytes "MacMemory.h" , at 0x82a 410 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[CWIE]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0b 4d 61 63 4d 65 6d | 6f 72 79 2e 68 00 00 00 |..MacMem|ory.h...|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 01 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 07 aa 00 | 00 01 9a ac 3c d9 da ac |........|....<...|
|00000060| 3c d9 da 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |<.......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 28 ee 00 00 |........|....(...|
|00000080| 2f 2a 0d 4d 61 63 4d 65 | 6d 6f 72 79 2e 68 0d 0d |/*.MacMe|mory.h..|
|00000090| 52 65 64 65 66 69 6e 65 | 73 20 61 6c 6c 20 74 68 |Redefine|s all th|
|000000a0| 65 20 53 74 61 6e 64 61 | 72 64 20 43 20 6d 65 6d |e Standa|rd C mem|
|000000b0| 6f 72 79 20 61 6c 6c 6f | 63 61 74 69 6f 6e 20 66 |ory allo|cation f|
|000000c0| 75 6e 63 74 69 6f 6e 73 | 20 74 6f 20 62 65 20 69 |unctions| to be i|
|000000d0| 6d 70 6c 65 6d 65 6e 74 | 65 64 0d 64 69 72 65 63 |mplement|ed.direc|
|000000e0| 74 6c 79 20 61 73 20 63 | 61 6c 6c 73 20 74 6f 20 |tly as c|alls to |
|000000f0| 74 68 65 20 4d 61 63 69 | 6e 74 6f 73 68 20 4d 65 |the Maci|ntosh Me|
|00000100| 6d 6f 72 79 20 4d 61 6e | 61 67 65 72 2e 0d 0d 59 |mory Man|ager...Y|
|00000110| 6f 75 20 75 73 65 20 4d | 61 63 4d 65 6d 6f 72 79 |ou use M|acMemory|
|00000120| 2e 68 20 62 79 20 61 64 | 64 69 6e 67 20 74 68 65 |.h by ad|ding the|
|00000130| 20 6c 69 6e 65 0d 23 69 | 6e 63 6c 75 64 65 20 22 | line.#i|nclude "|
|00000140| 4d 61 63 4d 65 6d 6f 72 | 79 2e 68 22 0d 65 69 74 |MacMemor|y.h".eit|
|00000150| 68 65 72 20 74 6f 20 79 | 6f 75 72 20 54 48 49 4e |her to y|our THIN|
|00000160| 4b 2f 43 6f 64 65 57 61 | 72 72 69 6f 72 20 43 20 |K/CodeWa|rrior C |
|00000170| 70 72 6f 6a 65 63 74 20 | 70 72 65 66 69 78 20 6f |project |prefix o|
|00000180| 72 20 74 6f 20 73 6f 6d | 65 20 68 65 61 64 65 72 |r to som|e header|
|00000190| 20 66 69 6c 65 20 74 68 | 61 74 20 0d 79 6f 75 20 | file th|at .you |
|000001a0| 69 6e 63 6c 75 64 65 20 | 69 6e 20 61 6c 6c 20 79 |include |in all y|
|000001b0| 6f 75 72 20 66 69 6c 65 | 73 2e 0d 0d 53 79 6d 61 |our file|s...Syma|
|000001c0| 6e 74 65 63 20 69 73 20 | 72 61 74 68 65 72 20 61 |ntec is |rather a|
|000001d0| 70 6f 6c 6f 67 65 74 69 | 63 20 61 62 6f 75 74 20 |pologeti|c about |
|000001e0| 74 68 65 20 70 6f 6f 72 | 20 70 65 72 66 6f 72 6d |the poor| perform|
|000001f0| 61 6e 63 65 20 6f 66 20 | 74 68 65 69 72 20 6d 65 |ance of |their me|
|00000200| 6d 6f 72 79 0d 6d 61 6e | 61 67 65 72 2c 20 77 68 |mory.man|ager, wh|
|00000210| 69 63 68 20 69 6d 70 6c | 65 6d 65 6e 74 73 20 74 |ich impl|ements t|
|00000220| 68 65 20 53 74 61 6e 64 | 61 72 64 20 43 20 6c 69 |he Stand|ard C li|
|00000230| 62 72 61 72 79 20 66 75 | 6e 63 74 69 6f 6e 73 20 |brary fu|nctions |
|00000240| 66 72 65 65 2c 20 6d 61 | 6c 6c 6f 63 2c 20 63 61 |free, ma|lloc, ca|
|00000250| 6c 6c 6f 63 2c 0d 61 6e | 64 20 72 65 61 6c 6c 6f |lloc,.an|d reallo|
|00000260| 63 20 28 54 48 49 4e 4b | 20 52 65 66 65 72 65 6e |c (THINK| Referen|
|00000270| 63 65 3a 53 74 61 6e 64 | 61 72 64 20 4c 69 62 72 |ce:Stand|ard Libr|
|00000280| 61 72 69 65 73 3a 22 41 | 6c 6c 6f 63 61 74 69 6e |aries:"A|llocatin|
|00000290| 67 20 4d 65 6d 6f 72 79 | 22 29 2e 20 54 68 65 20 |g Memory|"). The |
|000002a0| 54 48 49 4e 4b 0d 43 20 | 6d 65 6d 6f 72 79 20 6d |THINK.C |memory m|
|000002b0| 61 6e 61 67 65 72 20 72 | 65 71 75 65 73 74 73 20 |anager r|equests |
|000002c0| 31 35 20 4b 42 20 28 6f | 72 20 6c 61 72 67 65 72 |15 KB (o|r larger|
|000002d0| 29 20 63 68 75 6e 6b 73 | 20 6f 66 20 6d 65 6d 6f |) chunks| of memo|
|000002e0| 72 79 20 66 72 6f 6d 20 | 41 70 70 6c 65 27 73 20 |ry from |Apple's |
|000002f0| 6d 65 6d 6f 72 79 0d 6d | 61 6e 61 67 65 72 20 61 |memory.m|anager a|
|00000300| 6e 64 20 74 68 65 6e 20 | 64 6f 6c 65 73 20 6f 75 |nd then |doles ou|
|00000310| 74 20 74 68 69 73 20 6d | 65 6d 6f 72 79 20 74 6f |t this m|emory to|
|00000320| 20 79 6f 75 72 20 70 72 | 6f 67 72 61 6d 20 69 6e | your pr|ogram in|
|00000330| 20 77 68 61 74 65 76 65 | 72 20 73 69 7a 65 20 70 | whateve|r size p|
|00000340| 69 65 63 65 73 0d 79 6f | 75 20 72 65 71 75 65 73 |ieces.yo|u reques|
|00000350| 74 2e 20 54 68 65 20 70 | 72 6f 62 6c 65 6d 20 69 |t. The p|roblem i|
|00000360| 73 20 74 68 61 74 20 74 | 68 65 20 54 48 49 4e 4b |s that t|he THINK|
|00000370| 20 43 20 6d 65 6d 6f 72 | 79 20 6d 61 6e 61 67 65 | C memor|y manage|
|00000380| 72 20 69 73 6e 27 74 20 | 73 6d 61 72 74 20 65 6e |r isn't |smart en|
|00000390| 6f 75 67 68 0d 74 6f 20 | 72 65 63 6f 6d 62 69 6e |ough.to |recombin|
|000003a0| 65 20 70 69 65 63 65 73 | 20 79 6f 75 20 72 65 74 |e pieces| you ret|
|000003b0| 75 72 6e 20 74 6f 20 69 | 74 20 76 69 61 20 66 72 |urn to i|t via fr|
|000003c0| 65 65 2c 20 73 6f 20 70 | 72 6f 67 72 61 6d 73 20 |ee, so p|rograms |
|000003d0| 28 6c 69 6b 65 20 51 75 | 65 73 74 29 0d 74 68 61 |(like Qu|est).tha|
|000003e0| 74 20 64 6f 20 61 20 6c | 6f 74 20 6f 66 20 61 6c |t do a l|ot of al|
|000003f0| 6c 6f 63 61 74 69 6f 6e | 20 61 6e 64 20 66 72 65 |location| and fre|
|00000400| 65 69 6e 67 20 65 6e 64 | 20 75 70 20 74 72 69 67 |eing end| up trig|
|00000410| 67 65 72 69 6e 67 20 74 | 68 65 20 54 48 49 4e 4b |gering t|he THINK|
|00000420| 20 43 20 6d 65 6d 6f 72 | 79 0d 6d 61 6e 61 67 65 | C memor|y.manage|
|00000430| 72 20 74 6f 20 6b 65 65 | 70 20 61 73 6b 69 6e 67 |r to kee|p asking|
|00000440| 20 66 6f 72 20 6e 65 77 | 20 31 35 4b 42 20 63 68 | for new| 15KB ch|
|00000450| 75 6e 6b 73 20 74 68 61 | 74 20 65 76 65 6e 74 75 |unks tha|t eventu|
|00000460| 61 6c 6c 79 20 75 73 65 | 20 75 70 20 61 6c 6c 20 |ally use| up all |
|00000470| 66 72 65 65 0d 6d 65 6d | 6f 72 79 20 75 6e 74 69 |free.mem|ory unti|
|00000480| 6c 20 74 68 65 20 70 72 | 6f 67 72 61 6d 20 66 61 |l the pr|ogram fa|
|00000490| 69 6c 73 20 66 6f 72 20 | 6c 61 63 6b 20 6f 66 20 |ils for |lack of |
|000004a0| 6d 65 6d 6f 72 79 2e 20 | 53 70 75 72 69 6f 75 73 |memory. |Spurious|
|000004b0| 6c 79 20 65 61 74 69 6e | 67 20 75 70 20 66 72 65 |ly eatin|g up fre|
|000004c0| 65 20 0d 6d 65 6d 6f 72 | 79 20 69 73 20 63 61 6c |e .memor|y is cal|
|000004d0| 6c 65 64 20 61 20 22 6d | 65 6d 6f 72 79 20 6c 65 |led a "m|emory le|
|000004e0| 61 6b 22 2e 0d 0d 54 68 | 65 20 62 65 6e 65 66 69 |ak"...Th|e benefi|
|000004f0| 74 20 6f 66 20 75 73 69 | 6e 67 20 4d 61 63 4d 65 |t of usi|ng MacMe|
|00000500| 6d 6f 72 79 2e 68 20 69 | 73 20 74 68 61 74 20 79 |mory.h i|s that y|
|00000510| 6f 75 20 77 69 6c 6c 20 | 75 73 65 20 6d 65 6d 6f |ou will |use memo|
|00000520| 72 79 20 65 66 66 69 63 | 69 65 6e 74 6c 79 2e 0d |ry effic|iently..|
|00000530| 54 68 65 20 64 69 73 61 | 64 76 61 6e 74 61 67 65 |The disa|dvantage|
|00000540| 20 69 73 20 74 68 61 74 | 20 69 74 20 69 73 20 70 | is that| it is p|
|00000550| 6f 73 73 69 62 6c 65 20 | 28 49 20 68 61 76 65 6e |ossible |(I haven|
|00000560| 27 74 20 63 68 65 63 6b | 65 64 29 20 74 68 61 74 |'t check|ed) that|
|00000570| 20 74 68 65 20 54 48 49 | 4e 4b 20 43 0d 6d 65 6d | the THI|NK C.mem|
|00000580| 6f 72 79 20 6d 61 6e 61 | 67 65 72 20 69 73 20 6d |ory mana|ger is m|
|00000590| 75 63 68 20 71 75 69 63 | 6b 65 72 20 66 6f 72 20 |uch quic|ker for |
|000005a0| 61 20 73 65 72 69 65 73 | 20 6f 66 20 73 6d 61 6c |a series| of smal|
|000005b0| 6c 20 61 6c 6c 6f 63 61 | 74 69 6f 6e 73 2e 20 54 |l alloca|tions. T|
|000005c0| 68 65 20 41 70 70 6c 65 | 0d 4d 65 6d 6f 72 79 20 |he Apple|.Memory |
|000005d0| 4d 61 6e 61 67 65 72 20 | 69 73 20 71 75 69 74 65 |Manager |is quite|
|000005e0| 20 73 6c 6f 77 2e 20 45 | 2e 67 2e 20 63 61 6c 6c | slow. E|.g. call|
|000005f0| 73 20 74 6f 20 4e 65 77 | 47 57 6f 72 6c 64 20 74 |s to New|GWorld t|
|00000600| 61 6b 65 20 30 2e 32 20 | 73 20 6f 6e 20 61 20 4d |ake 0.2 |s on a M|
|00000610| 61 63 20 49 49 2c 0d 61 | 6e 64 20 6d 79 20 69 6d |ac II,.a|nd my im|
|00000620| 70 72 65 73 73 69 6f 6e | 20 69 73 20 74 68 61 74 |pression| is that|
|00000630| 20 6d 6f 73 74 20 6f 66 | 20 74 68 69 73 20 74 69 | most of| this ti|
|00000640| 6d 65 20 69 73 20 74 61 | 6b 65 6e 20 75 70 20 61 |me is ta|ken up a|
|00000650| 6c 6c 6f 63 61 74 69 6e | 67 20 6d 65 6d 6f 72 79 |llocatin|g memory|
|00000660| 2e 0d 0d 48 49 53 54 4f | 52 59 3a 0d 33 2f 35 2f |...HISTO|RY:.3/5/|
|00000670| 39 34 20 64 67 70 20 77 | 72 6f 74 65 20 69 74 2e |94 dgp w|rote it.|
|00000680| 0d 31 31 2f 31 35 2f 39 | 34 20 64 67 70 20 23 69 |.11/15/9|4 dgp #i|
|00000690| 6e 63 6c 75 64 65 20 3c | 73 74 64 6c 69 62 2e 68 |nclude <|stdlib.h|
|000006a0| 3e 20 73 6f 20 74 68 61 | 74 20 54 48 49 4e 4b 20 |> so tha|t THINK |
|000006b0| 43 20 77 69 6c 6c 20 72 | 65 61 64 20 69 6e 20 74 |C will r|ead in t|
|000006c0| 68 65 20 64 65 66 69 6e | 69 74 69 6f 6e 20 6f 66 |he defin|ition of|
|000006d0| 20 73 69 7a 65 5f 74 2e | 0d 2a 2f 0d 23 70 72 61 | size_t.|.*/.#pra|
|000006e0| 67 6d 61 20 6f 6e 63 65 | 09 2f 2f 20 4f 6e 6c 79 |gma once|.// Only|
|000006f0| 20 69 6e 63 6c 75 64 65 | 20 74 68 69 73 20 6f 6e | include| this on|
|00000700| 63 65 2e 0d 0d 23 69 66 | 6e 64 65 66 20 5f 53 54 |ce...#if|ndef _ST|
|00000710| 44 4c 49 42 0d 09 23 69 | 6e 63 6c 75 64 65 20 3c |DLIB..#i|nclude <|
|00000720| 73 74 64 6c 69 62 2e 68 | 3e 09 2f 2f 20 73 69 7a |stdlib.h|>.// siz|
|00000730| 65 5f 74 0d 23 65 6e 64 | 69 66 0d 76 6f 69 64 20 |e_t.#end|if.void |
|00000740| 2a 4d 61 63 52 65 61 6c | 6c 6f 63 28 76 6f 69 64 |*MacReal|loc(void|
|00000750| 20 2a 6f 6c 64 50 74 72 | 2c 73 69 7a 65 5f 74 20 | *oldPtr|,size_t |
|00000760| 73 69 7a 65 29 3b 0d 23 | 64 65 66 69 6e 65 20 66 |size);.#|define f|
|00000770| 72 65 65 28 70 74 72 29 | 20 44 69 73 70 6f 73 65 |ree(ptr)| Dispose|
|00000780| 50 74 72 28 28 50 74 72 | 29 28 70 74 72 29 29 0d |Ptr((Ptr|)(ptr)).|
|00000790| 23 64 65 66 69 6e 65 20 | 6d 61 6c 6c 6f 63 28 62 |#define |malloc(b|
|000007a0| 79 74 65 73 29 20 28 76 | 6f 69 64 20 2a 29 4e 65 |ytes) (v|oid *)Ne|
|000007b0| 77 50 74 72 28 62 79 74 | 65 73 29 0d 23 64 65 66 |wPtr(byt|es).#def|
|000007c0| 69 6e 65 20 63 61 6c 6c | 6f 63 28 6e 2c 73 69 7a |ine call|oc(n,siz|
|000007d0| 65 29 20 28 76 6f 69 64 | 20 2a 29 4e 65 77 50 74 |e) (void| *)NewPt|
|000007e0| 72 43 6c 65 61 72 28 28 | 73 69 7a 65 5f 74 29 28 |rClear((|size_t)(|
|000007f0| 6e 29 2a 28 73 69 7a 65 | 29 29 0d 23 64 65 66 69 |n)*(size|)).#defi|
|00000800| 6e 65 20 72 65 61 6c 6c | 6f 63 28 70 74 72 2c 73 |ne reall|oc(ptr,s|
|00000810| 69 7a 65 29 20 4d 61 63 | 52 65 61 6c 6c 6f 63 28 |ize) Mac|Realloc(|
|00000820| 70 74 72 2c 73 69 7a 65 | 29 0d 00 00 00 00 00 00 |ptr,size|).......|
|00000830| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000840| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000850| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000860| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000870| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000880| 00 00 01 00 00 00 01 54 | 00 00 00 54 00 00 00 46 |.......T|...T...F|
|00000890| 64 61 72 64 20 68 65 61 | 64 65 72 20 2a 2f 0d 23 |dard hea|der */.#|
|000008a0| 69 66 6e 64 65 66 20 5f | 53 54 52 49 4e 47 0d 23 |ifndef _|STRING.#|
|000008b0| 0b 4d 61 63 4d 65 6d 6f | 72 79 2e 68 02 00 00 00 |.MacMemo|ry.h....|
|000008c0| 54 45 58 54 43 57 49 45 | 01 00 00 28 03 60 00 00 |TEXTCWIE|...(.`..|
|000008d0| 00 00 54 45 58 54 43 57 | 49 45 01 00 00 28 03 60 |..TEXTCW|IE...(.`|
|000008e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000008f0| 00 00 a9 9e 2b 2d 00 00 | 07 aa 00 00 01 9a 61 20 |....+-..|......a |
|00000900| 6f 70 74 69 6f 6e 73 20 | 61 6c 69 67 6e 3d 6d 61 |options |align=ma|
|00000910| 63 36 38 6b 0d 23 65 6e | 64 69 66 0d 0d 09 09 2f |c68k.#en|dif..../|
|00000920| 2a 20 6d 61 63 72 6f 73 | 20 2a 2f 0d 23 69 66 6e |* macros| */.#ifn|
|00000930| 64 65 66 20 4e 55 4c 4c | 0d 23 64 65 66 69 6e 65 |def NULL|.#define|
|00000940| 20 4e 55 4c 4c 09 5f 4e | 55 4c 4c 0d 23 65 6e 64 | NULL._N|ULL.#end|
|00000950| 69 66 0d 09 09 2f 2a 20 | 74 79 70 65 20 64 65 66 |if.../* |type def|
|00000960| 69 6e 69 74 69 6f 6e 73 | 20 2a 2f 0d 23 69 66 6e |initions| */.#ifn|
|00000970| 64 65 66 20 5f 53 49 5a | 45 54 0d 23 64 65 66 69 |def _SIZ|ET.#defi|
|00000980| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 00 00 00 |...H..Mo|naco....|
|00000990| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000009a0| 00 00 00 00 00 00 00 03 | 00 04 00 3d 00 03 01 a0 |........|...=....|
|000009b0| 02 7d 00 3d 00 03 01 a0 | 02 7d ac 3c a1 a2 00 00 |.}.=....|.}.<....|
|000009c0| 06 bb 00 00 06 bb 00 00 | 02 26 00 00 00 00 00 04 |........|.&......|
|000009d0| 00 01 00 01 00 00 01 00 | 00 00 01 54 00 00 00 54 |........|...T...T|
|000009e0| 00 00 00 46 01 99 5f e8 | 1e 1e 00 00 00 1c 00 46 |...F.._.|.......F|
|000009f0| 00 01 4d 50 53 52 00 00 | 00 12 4d 57 42 42 00 00 |..MPSR..|..MWBB..|
|00000a00| 00 1e 03 ed ff ff 00 00 | 00 00 00 00 00 00 03 f0 |........|........|
|00000a10| ff ff 00 00 00 4c 00 00 | 00 00 00 00 00 00 00 00 |.....L..|........|
|00000a20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000a70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+