- Inside Macintosh: Memory /
- Chapter 1 - Introduction to Memory Management / Memory Management Reference
Memory Management Routines
This section describes the routines you can use to set up your application's heap, allocate and dispose of relocatable and nonrelocatable blocks, manipulate those blocks, assess the availability of memory in your application's heap, free memory from the heap, and install a grow-zone function for your heap.
- Note
- The result codes listed for Memory Manager routines are usually not directly returned to your application. You need to call the
MemError function (or, from assembly language, inspect the MemErr global variable) to get a routine's result code.
You cannot call most Memory Manager routines at interrupt time for several reasons. You cannot allocate memory at interrupt time because the Memory Manager might already be handling a memory-allocation request and the heap might be in an inconsistent state. More generally, you cannot call at interrupt time any Memory Manager routine that returns its result code via the MemError function, even if that routine doesn't allocate or move memory. Resetting the MemErr global variable at interrupt time can lead to unexpected results if the interrupted code depends on the value of MemErr. Note that Memory Manager routines like HLock return their results via MemError and therefore should not be called in interrupt code.
Subtopics
- Setting Up the Application Heap
-
- Allocating and Releasing Relocatable Blocks of Memory
-
- Allocating and Releasing Nonrelocatable Blocks of Memory
-
- Setting the Properties of Relocatable Blocks
-
- Managing Relocatable Blocks
-
- Manipulating Blocks of Memory
-
- Assessing Memory Conditions
-
- Grow-Zone Operations
-
- Setting and Restoring the A5 Register
-
© Apple Computer, Inc.
3 JUL 1996