Chapter 24 -
This chapter describes how to use MacApp's memory management routines to allocate memory and ensure that critical allocations are successful. It also describes how to use MacApp's failure-handling mechanism in your application.
Working With Memory and Failure HandlingThis chapter includes recipes and sample code that demonstrate how to
For a detailed description of MacApp memory management and failure handling, see Chapter 3, "Core Technologies."
- define segment names for your application (for 68K applications only)
 - define a
 'res!'resource to specify resident segments (for 68K applications only)- define a
 'seg!'resource to specify segment usage (for 68K applications only)- avoid problems with register variables in failure handlers
 
Chapter Contents
- Memory Overview
 
- Ensuring That Critical Memory Requests Succeed
 - Managing Object Allocation Efficiently
 - Allocating Permanent and Temporary Memory
 - MacApp's Memory Allocation Routines
 - Allocating Permanent Memory
 - Allocating Temporary Memory
 - Allocating Memory for Objects
 - Allocating Memory for Lists
 - Allocating Memory for List and Objects
 - Allocating Master Pointers for the Application
 - 'mem!', '68k!', and 'ppc!' Resources
 - Recipes--Memory (68K Only)
 
- Recipe--Defining Segment Names for Your Application
 - Recipe--Defining a 'res!' Resource
 - Identify Code That Should Always Be Resident
 - Map Related Code to the Same Segment
 - Create a 'res!' Resource That Lists Resident Segments
 - Recipe--Defining a 'seg!' Resource
 - Identify Segments in Memory at Greatest Memory Usage
 - Identify MacApp Segments Also in Memory
 - Create a 'seg!' Resource That Lists the Segments
 - Failure-Handling Overview
 
- MacApp Error-Checking Routines
 - The Failure Routine
 - How Error Messages Are Displayed
 - Setting the Error Message in a Failure Handler
 - Calling the Failure Routine Directly
 - Recipes--Failure Handling
 
- Recipe--Avoiding Register Variables in Failure Handlers