Problems from insufficient RAM and free hard disk space

If you have a limited amount of either RAM (memory) or available — free or unused — space on your Mac® OS X startup disk, you may encounter problems including kernel panics, the inability to burn CDs or DVDs, or the apparent loss of application preferences.

This FAQ, which is derived from a chapter from our book Troubleshooting Mac OS X, describes the basis of these problems and solutions for such.

Memory management in Mac OS X

Applications and processing on your Mac require physical RAM to work. The more applications you launch or the larger the files those applications work upon, the more physical RAM is consumed.

To efficiently use your available RAM, Mac OS X employs a strategy common to all modern operation systems known as Virtual Memory (VM). For a detailed technical discussion of VM management in Mac OS X, see the "Memory Management in Mac OS X" chapter of the Apple® Developer Connection document Memory Usage Performance Guidelines.

Paging is a key activity of VM. Paging involves copying data between RAM and special files on your Mac OS X startup disk known as swap files. The use of swap files gives the appearance of the system having more RAM than is physically installed. Paging involves page-outs and page-ins:

  • To free RAM for other applications and processing, data is copied from RAM to a swap file. This is known as a page-out.
  • When you switch to an application whose memory has been paged-out to a swap file, Mac OS X performs a page-in, copying the application's memory image from the swap file back into RAM.

The degree to which Mac OS X relies on VM depends on how much RAM you have installed and how much of that RAM is available, i.e. not currently in use. Paging increases with physical RAM use: the more RAM in use, the more paging may be employed as you launch applications or open documents.

Swap files are created and released dynamically and are saved in the /private/var/vm directory. However, the ability for Mac OS X to create a swap file depends on your Mac having free space on the Mac OS X startup disk.

Depending upon the load you are placing upon your system — the number of applications running concurrently, the number and sizes of files each application is working upon, and other factors — it is technically possible to exhaust both your Mac's physical RAM and the free space on the startup disk that is available for swap files.

Problems from lack of RAM or hard disk space

Problems arising from insufficient RAM or available hard disk space include:

  • Slow performance.
  • Kernel panics.
  • Inability to:
    • Burn CDs or DVDs.
    • Start the Classic environment.
    • Install software, either via Software Update or using third-party installers.
    • Reinstall Mac OS X via Archive and Install .
    • Enable or disable FileVault®.
  • "Lost" application preferences. The reason for this perplexing situation is as follows:
    • Many applications update their preferences when the application is launched. These updates, and any changes you make to the application's Preferences while using it, are preserved by writing the changes to the application's preferences file on the hard disk. Applications also include Mac OS X components such as Finder™ and the Dock.
    • When your hard disk is almost full, it may be impossible for the application to save its updated preferences. This may result in a situation where you find the preferences for an application appear to have been reset to their default values. For example, you may lose all your Dock settings. This can also result in some applications failing to launch in future.

These problems are even more likely to occur when the startup disk was nearly full to begin with, physical RAM is exhausted, and free disk space is consumed by swap files.

To avoid these problem, it is necessary to minimize the potential impact of page-outs by either increasing RAM, available space on the startup disk, or both.

Determining if your system is at risk

You determine if your system is at risk of experiencing the problems above by checking both the available space on your Mac OS X startup disk and how much paging your system is performing.

Determine the available space on your Mac OS X startup disk

  1. In Finder®, select the startup disk icon. For most users, this is Macintosh HD.
  2. Press the Command-I keyboard shortcut.
  3. The Info window for your startup disk opens. In the General pane, the Capacity, Available (free space), and space Used on your startup disk is displayed, as seen in the following screen shot:
  • As a general rule of thumb: if the Available space on the Mac OS X startup disk is less than 10 GB, it is time to free some disk space. We suggest 10 GB as an absolute minimum as this is generally the amount of free space required to reinstall Mac OS X 10.5 and earlier via an Archive and Install and still preserve space for VM swap files. More free space is better. For example, users of FileVault may want to retain more free space than that occupied by their encrypted Home folder: disabling FileVault requires free space somewhat greater than the size of your encrypted Home folder.

Determine how much paging your system is performing

  1. Open Terminal, located in the Macintosh HD > Applications > Utilities folder.
  2. At the prompt, type top and press Return.
  3. Examine the output generated by top. For example:
  • Processes: 65 total, 3 running, 1 stuck, 61 sleeping, 319 threads 09:54:54
    Load Avg: 0.01, 0.09, 0.13 CPU usage: 3.12% user, 0.96% sys, 95.91% idle
    SharedLibs: 4164K resident, 15M data, 0B linkedit.
    MemRegions: 17316 total, 1222M resident, 22M private, 676M shared.
    PhysMem: 481M wired, 2204M active, 1284M inactive, 3970M used, 2165M free.
    VM: 152G vsize, 1043M framework vsize, 125745(0) pageins, 0(0) pageouts.
    Networks: packets: 192696/233M in, 132174/21M out.
    Disks: 71776/2296M read, 168331/2806M written.

At then end of the PhysMem (Physical Memory) line, we see that the Mac in this example has 6 GB of RAM (3,970 MB used + 2,165 MB free = 6,135 MB = 6 GB).

Now note the pageins and pageouts in the last or VM (virtual memory) line:

125745(0) pageins, 0(0) pageouts

The numbers before the parentheses, 125745 and 0 in this example, indicate the total pageins and pageouts, respectively, performed since this Mac was last restarted. Over time, both numbers will increase. If the total pageouts is low — ideally 0 — compared to the number of pageins after having used your Mac for hours of work, you may have sufficient RAM. Otherwise, you should install more RAM.

The numbers within the parentheses are the most important: these indicate the number of pageins or pageouts performed in the last one second. If these values — especially pageouts — are consistently in the range of 25 to 50 or more, then the system is thrashing: paging excessively as it is starved for RAM at its current workload. Overall performance will slow as the CPU spends more time paging than on other work. If your Mac is thrashing, you need to install more RAM!

With 6 GB of RAM, there are 0(0) pageouts, both since the last restart and in the last one second. If this Mac had 2 GB of RAM instead of 6 GB, then the number of pageouts would be higher since the current physical RAM in use is 3.97 GB. Recall that RAM use increases with every additional open application or document. If this Mac had 2 GB of RAM and we opened many applications and documents, the number of pageouts, both total and on a per-second basis, would be significantly higher. Depending on the mix of open applications and documents, with just 2 GB of RAM, thrashing could result.

However, even with a large complement of RAM, such as the 6 GB in this example, pageouts and pageins can be high with very processor-intensive activities, such as video playback or compression. Therefore, the numbers in parentheses — pages in or out per second — are the most critical in determining when thrashing is occurring and if more RAM is critically required.

To quit the top application, press the Control-C keyboard shortcut in Terminal. To end the Terminal Session, press the Control-D keyboard shortcut, then Quit (Command-Q) Terminal.

Upgrade to permanently resolve the problems

The only permanent solution to avoiding these problems is to install any or all of the following, assuming your Mac will accept such:

  • Additional RAM, preferably up to the limit your Mac will accept.
  • A larger hard drive for the Mac OS X startup disk.
  • For a Mac desktop, an additional internal hard drive for your data files, if feasible.

To avoid these problems while considering your upgrade options:

Related links

Did you find this FAQ helpful? You will find a wealth of additional advice for preventing or resolving Mac OS X problems in Dr. Smoke's book, Troubleshooting Mac® OS X.
Use of this site signifies your agreement to the terms of use.