Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Memory /
Chapter 2 - Memory Manager / Memory Manager Reference


Memory Manager Routines

This section describes the routines provided by the Memory Manager. You can use these routines to set up your application's partition, 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. The Memory Manager also provides routines that allow you to allocate temporary memory and manipulate heap zones.

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
Changing the Sizes of Relocatable and Nonrelocatable Blocks
Setting the Properties of Relocatable Blocks
Managing Relocatable Blocks
Manipulating Blocks of Memory
Assessing Memory Conditions
Freeing Memory
Grow-Zone Operations
Allocating Temporary Memory
Accessing Heap Zones
Manipulating Heap Zones

Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996