\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fc0\cf0 to measure all allocated memory in an application, or to measure the memory allocated since a given point in time.
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fc0\cf0 also contains a conservative garbage detector that can be used to detect memory leaks.\
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fc0\cf0 , you must link your application with a library containing a special version of
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fc0\cf0 will appear in the panel. Select an application by double-clicking its icon, and
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fc0\cf0 displays a list of all currently allocated nodes in your application. These nodes have been allocated by one of the standard C allocation functions (
\b malloc
\b0 ,
\b realloc
\b0 ,
\b calloc
\b0 , or
\b valloc
\b0 ) or one of NeXT's zone allocation functions (
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fc0\cf0 ). Each row displays the zone in which the node was allocated, the address and size of the node and the procedure that allocated the node. The nodes can be sorted by allocator, by order of al
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fc0\cf0 also detects nodes that have been written to incorrectly. If your application has written past the end of a node, a right arrow (`>') appears by the node. Similarly, if your application has written before the start of a node, a left arrow (`<') appears by the node. Many of these errors are the result of using the result of
\b strlen(s)
\b0 as the argument to
\b malloc
\b0 for a string instead of
\b strlen (s) + 1
\b0 . Damaged nodes are listed first in all sorting modes.\
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fc0\cf0 searches through your program's memory for pointers to each node. Any node that cannot be referenced is displayed as a memory leak. Since the garbage detector cannot know which words in memory are pointers, it is possible that an integer has the same value as a pointer to a given node. In this case that node doesn't show up as a leak, even though it really is. This is why the garbage detector is called
\i conservative
\i0 . In practice, this problem is very rare.\
The second caveat is that the garbage detector only searches for references to the
\i beginning
\i0 of each node. If your program doesn't retain a pointer to the start of a node, but instead retains a pointer into the middle of it, that node will show up as a leak even though it really isn't one.\
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\b0\fc0\cf0 can show you the memory usage of a given portion of your program. To begin measur
press the
\i Mark
\i0 button. After exercising a portion of your program, press the
\i New
\i0 button to see the nodes allocated since the mark. Note that