System 7: Virtual Memory and Largest Unused Block

My Macintosh has 4MB of RAM, and I set it to 24-bit addressing mode with 13MB of virtual memory. I see the following distribution of RAM according to "About This Macintosh."

Built-in memory 4,096K
Total memory 13,312K
System Software 1,577K
Largest Unused Block 7,319K

System Software added to Largest Unused Block equals 8,896K. This leaves 4,416K missing.

When I set the Macintosh to 32-bit mode, I see the following distribution of RAM:

Built-in memory 4,096K
Total memory 13,312K
System Software 1,577K
Largest Unused Block 11,712K

System Software plus Largest Unused Block equals 13,289K.

Why does there appear to be more memory available with 32-bit addressing turned on?
Virtual memory in 24-bit addressing mode fragments the memory available when you set the memory size to greater than 8MB. Virtual memory in 32-bit addressing doesn't face this limitation. The following examples show how this happens.

24-Bit Addressing
Setting your Macintosh to 24-bit addressing mode makes 16MB available to the computer. Here's what the memory map looks like in 24-bit mode:

MB          Function
--          --------
1-8         Physical & Virtual RAM
9           ROM
10-15       NuBus slots
16          I/O

When you set virtual memory greater than 8MB, the location of ROM in the memory map fragments the free memory. So the largest block available will always be 8MB minus memory any running applications use, until you exceed 8MB. After exceeding 8MB, the largest available blocks are the memory mapped into NuBus slot space.

The memory available to applications (application heap) includes the first 8 megabytes, plus any memory the NuBus cards (10-15) aren't using that has been mapped as memory by virtual memory. This is where the RAM available under virtual memory becomes fragmented. In the example of RAM distribution for 24-bit addressing, 11,735K of RAM is really available for the application heap even though the Largest Unused Block shows as only 7,319K.

32-Bit Addressing
Setting the Macintosh to 32-bit mode prevents fragmenting available memory because it maps ROM and I/O to the top of the memory map. This makes 1GB available to the computer. Here's what the memory map looks like in 32-bit mode:

Memory      Function
------      --------
1GB         Physical & Virtual RAM
256MB       ROM
2.5GB       NuBus slots
256MB       I/O

Virtual memory in 32-bit mode only accesses the 1GB RAM memory space. This leaves the memory space between system heap and ROM available. The application heap is a contiguous block in the top thousand megabytes of the memory map. In the example for 32-bit addressing, the Largest Unused Block (11,712K) is equal to the total RAM available for the application heap.
Published Date: Feb 18, 2012