Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: Memory /


Figures, Tables, and Listings

Preface About This Book xi

Chapter 1 Introduction to Memory Management 1-1

Figure 1-1 Memory organization with several applications open 1-5

Figure 1-2 Organization of an application partition 1-7

Figure 1-3 The application stack 1-9

Figure 1-4 A fragmented heap 1-10

Figure 1-5 A compacted heap 1-11

Figure 1-6 Organization of an application's A5 world 1-12

Figure 1-7 Using temporary memory allocated from unused RAM 1-14

Figure 1-8 A pointer to a nonrelocatable block 1-17

Figure 1-9 A handle to a relocatable block 1-19

Figure 1-10 Purging and reallocating a relocatable block 1-22

Figure 1-11 Allocating a nonrelocatable block 1-23

Figure 1-12 An effectively partitioned heap 1-26

Listing 1-1 Locking a block to avoid dangling pointers 1-30

Listing 1-2 Creating a fake handle 1-35

Listing 1-3 Increasing the amount of space allocated for the stack 1-40

Listing 1-4 Setting up your application heap and stack 1-42

Listing 1-5 Determining whether allocating memory would deplete the memory cushion 1-43

Listing 1-6 Allocating relocatable blocks 1-44

Listing 1-7 Allocating nonrelocatable blocks 1-45

Listing 1-8 Allocating a dialog record 1-45

Listing 1-9 Creating an emergency memory reserve 1-46

Listing 1-10 Checking the emergency memory reserve 1-47

Listing 1-11 Determining whether allocating memory would deplete the memory cushion 1-47

Listing 1-12 Reallocating the emergency memory reserve 1-48

Listing 1-13 A grow-zone function that releases emergency storage 1-49

Chapter 2 Memory Manager 2-1

Listing 2-1 Reading the value of a system global variable 2-8

Listing 2-2 Changing the value of a system global variable 2-9

Listing 2-3 Determining whether temporary-memory routines are available 2-12

Listing 2-4 Calling a procedure by address 2-13

Listing 2-5 Creating a subzone of the original application heap zone 2-15

Listing 2-6 A purge-warning procedure 2-17

Listing 2-7 Installing a purge-warning procedure 2-18

Listing 2-8 A purge-warning procedure that calls the Resource Manager's procedure 2-19

Figure 2-1 A block header in a 24-bit zone 2-22

Figure 2-2 A block header in a 32-bit zone 2-23

Chapter 3 Virtual Memory Manager 3-1

Figure 3-1 24-bit Memory Manager logical address space 3-6

Figure 3-2 32-bit Memory Manager logical address space 3-8

Figure 3-3 The physical address space on a Macintosh IIci with 8 MB of RAM 3-10

Listing 3-1 Translating logical to physical addresses 3-19

Chapter 4 Memory Management Utilities 4-1

Figure 4-1 The Memory control panel 4-4

Table 4-1 Caches available in MC680x0 microprocessors 4-9

Figure 4-2 Initializing a status code 4-11

Figure 4-3 Reading stale data 4-12

Figure 4-4 Reading invalid instructions 4-13

Listing 4-1 A sample grow-zone function 4-15

Listing 4-2 Passing A5 to a notification response procedure 4-16

Listing 4-3 Setting up and restoring the A5 register at interrupt time 4-17

Listing 4-4 Structure of the QuickDraw global variables 4-18

Listing 4-5 Copying the QuickDraw global variables into a record 4-19

Listing 4-6 A control's draw routine using the calling application's QuickDraw patterns 4-19

Listing 4-7 Stripping the program counter 4-21

Listing 4-8 Stripping addresses in time-critical code 4-23

Listing 4-9 Calculating the StripAddress mask 4-23

Listing 4-10 Translating 24-bit to 32-bit addresses 4-24


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996




Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help