Read an Excerpt
Memory and Other Seemingly Complicated Arcana
In This Chapter
- Running out of RAM
- The Memory control panel
- The disk cache
- Virtual memory
- The RAM disk
- Memory-related troubleshooting
The Mac lets the user -- that's you -- get along fine without knowing much about memory. Many users go through their entire lives with a Macintosh without knowing anything more than "it has 32 megs in it."
On the other hand, a working knowledge of the way your Mac's memory works can be invaluable in getting the most out of your Mac.
In other words, you don't have to know this stuff, but it's likely to come in handy someday. It's not particularly complicated or particularly technical, so it wouldn't hurt to just jump right in.
Baby, Baby, Where Did Our RAM Go?
RAM is the TLA (three-letter acronym) for Random Access Memory. RAM is the special kind of memory in which your System software and applications live while your Mac uses them. System software (including most extensions and control panels) loads into RAM on startup; applications load into RAM when you open them.
Your Mac probably came with 8, 16, or 32 megabytes of RAM. Depending on what you want to do, that amount may or may not be enough.
If you never plan to do anything more than use a single program that doesn't require a massive amount of RAM (that is, not Photoshop or PageMaker, both of which require at least 6MB and 10MB of RAM respectively) and never plan to use two or more programs at once, a 16-meg Mac may let you squeak by.
If you have 32MB or less of RAM, read this chapter and Chapter 14 very, very carefully. The less RAM you have, the more important it is to manage it wisely.
If you want to keep a word processor, a calendar, a phone book, and a graphics program all open at the same time, a 16MB Mac may not have enough RAM for you. I actually consider 32MB the functional minimum for using Mac OS 8 effectively.
The simple rule is that the more stuff you want to run at once, the more RAM you're gonna need. If you have programs that require a lot of RAM, you'll need enough RAM to run them and your System software simultaneously. You'll also need even more RAM if you want to keep several programs open at the same time.
Go ahead: add more RAM
You can add more RAM to most Mac models easily and relatively inexpensively (between $5 and $10 per megabyte today, but prices change quickly, so check around before you buy).
If you are so inclined, you can install RAM yourself with a minimum of technical skills. Memory comes mounted on cute little printed circuit boards called SIMMs (fancy acronym for single in-line memory module) or DIMMs (fancy acronym for dual in-line memory module) that snap into little printed circuit boardholders inside your Mac. Installing RAM yourself will, of course, void your warranty. (On the other hand, if your Mac is more than 366 days old, it doesn't have a warranty.)
If you are technologically challenged and never want to lift the lid off your Mac (I don't blame you), you can have RAM installed for you at any Apple dealer. But this service costs significantly more than doing it yourself.
I'm a klutz. I don't repair things around the house. But I've managed to install RAM upgrades in several Macs without incident. It's not terribly difficult, and it doesn't require soldering or other specialized skills. If you can turn a screwdriver, you can probably handle the task.
If you do decide to go the do-it-yourself route, I recommend TechWorks (800-234-5670 or 512-794-8533). Their prices are fair, their support and manuals are superlative, and they offer a lifetime guarantee on every RAM chip they sell.
Essentially, you should remember that three things use RAM:
- The System and Finder
- Extensions and control panels
The first, the System and Finder, you have no control over. That dynamic duo is going to chew up almost 8 megabytes of RAM no matter what you do.
You do, however, have control over extensions, control panels, and applications, and you can use this control to make the most of the memory you have.
Okay. RAM is used primarily for three things. There's other stuff -- PRAM (parameter RAM), debuggers, rdev and scri files -- that could be rattling around in there, using up small amounts of your RAM. But their impact on the amount of RAM that you have to work with is negligible, so they're not important to this discussion. Besides, most people will never need to know what a scri file is.
Sigh. Okay, just this once. A scri file is a special kind of extension that automatically loads before all other extensions. The old System Update 3.0 that you should have been using with System 7.1 (but don't need with Mac OS 8) is a scri file. So is Apple's WorldScript Power Adapter.
System software memory theory: where some of the RAM goes...
To observe how RAM is being used on your Mac, look at the About This Computer window (Apple menu-->About This Computer).
Figure 9-1 shows a Mac running Mac OS 8. No extensions or control panels are loaded. The System software uses 7.7MB of RAM.
How do you get Mac OS 8 alone to load, without loading any extensions or control panels? Easy. Hold down the Shift key during startup until you see the "Extensions Off" message on the Welcome to Mac OS 8 screen. Memorize this tip; it's a good thing to know. If you run into memory problems (that is, if you see error messages with the word memory in them), starting up with your extensions turned off will enable you to run your Mac so that you can pinpoint problems related to any of your control panels or extensions.
On this 96MB Mac, after the System software eats up its share of RAM, 87.9MB of RAM is available for extensions, control panels, and applications.
Your mileage will vary, and you'll probably see a slightly different number on your Mac. Don't worry about it. The System software for each Mac model requires slightly different amounts of RAM.
When I restart my Mac the old-fashioned way, without holding the Shift key down, the extensions and control panels load as usual, and the System software expands to take up a whopping 12.4MB (see Figure 9-2). See what I mean about 16MB being the functional minimum? If you only have 16MB of RAM, you have less than 4 megabytes available for running applications. That's not enough. You'll need more RAM or virtual memory (covered soon).
This situation often causes confusion. When you look at the bar for System software in the About This Computer window, it displays not only the RAM used by your System and Finder but also the RAM used by your extensions and control panels that load at startup.
There's no way to tell how much of that bar is the System and Finder and how much is the extensions and control panels. The important thing is that the System software bar tells you how much combined RAM the System, Finder, extensions, and control panels use.
If you're good at math, you can figure out that loading the full complement of Mac OS 8 extensions and control panels costs 4.7MB of RAM.
12.4MB 7.7MB = 4.7MB.
On my 96-meg Mac, I'm left with almost 83 megabytes available for applications.
You can free up a bit more RAM for applications by turning off extensions and control panels in the Extensions Manager control panel. Read Chapter 14 for details on exactly how much RAM each extension and control panel uses and what happens if you turn them off.
Application memory theory: where the rest of the RAM goes
If you haven't read the first part of Chapter 4, which explains the About This Computer item in the Apple menu and provides you with your first glimpse of memory management, you should do so now. There's a very important technique there -- how to adjust Application memory -- and I'm not going to waste space repeating it.
Sigh. I guess I have to repeat at least part of it. This is, after all, a chapter about memory management.
When you launch an application, the application grabs a chunk of memory (RAM). You can see how big a chunk of RAM it grabs by going back to the Finder after you launch it and choosing Apple menu-->About This Computer (see Figure 9-3).
The beginning of Chapter 4 has a lengthy discourse on changing the amount of RAM a program grabs when you launch it and why you may want to do so. If you weren't paying attention, you diddle a program's RAM usage by selecting its icon and either choosing File-->Get Info or using the keyboard shortcut, Command-I (see Figure 9-4).
Here's a brief review of what these memory sizes mean:
- The Suggested Size is the size the manufacturer of the program recommends. In most cases, the Preferred Size should be set to at least this amount. You can't change the Suggested Size.
- The Minimum Size is the smallest amount of memory the program needs to run. It is usually (but not always) slightly smaller than the Suggested Size.
- The Preferred Size is the amount of memory the application requests (and will get as long as there is that much memory available when the application is launched). Your Mac doesn't let you set the Preferred Size lower than the Minimum Size.
When you try to open an application, if the available RAM (Largest Unused Block in the About This Computer window) is less than the Preferred Size but more than the Minimum Size, the program launches. But its performance may be degraded, or you may encounter memory-related errors.
Make sure that you're clear on this theory stuff before you move on to execution. RAM is used by three things: System software (and Finder), extensions and control panels, and applications.
You can make more RAM available for your programs by holding down the Shift key at startup, which disables all extensions and control panels.
You can fiddle with the amount of RAM that a program uses in its Get Info box.
Everything else you need to know about memory involves the Memory control panel, which you're about to meet.
The Shift-key-at-startup technique is wonderful, but it's absolutely absolute. Either your control panels and extensions are on, or they're off. The Shift key provides no way to turn some off and leave others on. When they're all off, you lose the ability to share files, to use desktop printers and the CD-ROM drive, and much more.
That's why Apple provides the Extensions Manager control panel, which has received a total face-lift in Mac OS 8. You use it to selectively disable and enable control panels and extensions. As I keep saying, this dandy tool is discussed in Chapter 14, a chapter designed to help you figure out which extensions and control panels you truly need. You'll find out how much precious RAM and disk space each control panel and extension uses, and you'll also discover how to get rid of the ones that you don't want (both temporarily and permanently).
In other words, Chapter 14 may be the most useful chapter in this book.
Memories Are Made of This: The Memory Control Panel
You configure memory-related functions for your Mac in the Memory control panel, which is in the Control Panels folder. You open the Memory control panel by choosing Apple menu-->Control Panels-->Memory.
Here's a look at the Memory control panel's components, which are for the most part unrelated.
Cashing in with the disk cache
The disk cache (pronounced "cash") is a portion of RAM set aside to hold frequently used instructions. In theory, if you set a reasonable-size cache, say 5 percent of your total RAM, your Mac should feel like it's running faster. In reality, many people can't tell the difference.
The first important thing to know is that the size of the disk cache is added onto the RAM used by the System software. Therefore, memory assigned to the disk cache is not available for programs to use. In Figure 9-2, the System software is using 12.4MB of RAM. The disk cache is set to 1,024K.
If I increase the size of the disk cache to 2,048K (see Figure 9-5) and restart the Mac, the System software balloons to 13.5MB (see Figure 9-6).
Those of you who caught the math thing a few pages ago have certainly noticed that the numbers here don't add up correctly. 13.5MB 12.4MB = 1.1MB, which does not equal 1MB or 1,024K as it should.
The vagaries of RAM usage are well known. The amount of RAM that System software uses changes from hour to hour, seemingly at random. I opened About This Computer three times today and got three different numbers, ranging from a low of 12.4MB to a high of 15.2MB.
In other words, RAM usage is not a precise science. Take all numbers in this chapter with at least one grain of salt.
How to set your disk cache
If RAM usage is an imprecise science, telling you how to set your disk cache is imprecise science fiction. Bearing that in mind, here's some excellent advice on figuring out the best setting for you.
As I said, some people don't notice the speed improvement provided by a larger disk cache. So first you must determine whether you can tell the difference in speed by cranking the disk cache size way up. Here's how to crank up the disk cache size:
- Choose Apple menu-->Control Panels-->Memory to open the Memory control panel.
- Click the upward-pointing arrow on the button labeled Cache Size repeatedly until it won't increase any further (see Figure 9-7).
- Click the down-arrow two or three times (so you leave enough RAM available to open an application).
- Restart your Mac.
You now have a huge disk cache, larger than you would actually use in real life. But I want you to exaggerate its effects for this experiment.
When your Mac gets back to the Finder, proceed to Step 5.
- Open the System Folder, noticing how long it takes for the window to appear completely.
- Close and then reopen the System Folder window, again noticing how long it takes to appear on-screen.
The difference in speed (the System Folder should have opened noticeably faster the second time) is a result of the increased size of the disk cache.
You should also notice a speed improvement when you scroll through documents. Launch your favorite application and scroll around a document for a while.
If you don't notice any speed improvement in the Finder or in your favorite application, return to the Memory control panel, set Cache Size to its lowest setting (96K or 32K), and be done with it.
If you notice (and like) the speed improvement, you still have a little more work to do. As you may remember, memory assigned to the disk cache is not available for applications. So you want to set the disk cache to the lowest possible number that still feels fast to you.
To lower the disk cache, repeat the preceding steps, lowering the disk cache one click each time. Restart after each change. Then close and reopen the System Folder two times and note the difference in speed the second time. When you begin to notice sluggishness when closing and opening or when scrolling through documents, then you've discovered your threshold. Return to the Memory control panel, increase Cache Size one click, and be done with it.
The old rule of thumb about the disk cache is to allow 32K per megabyte of RAM. I've always thought that this suggestion was bunk, as many people can't tell the difference between a 32K disk cache and a 1,024K disk cache. And why should they waste a megabyte of perfectly good RAM? So I've always encouraged people to try the experiment I've just described and see for themselves.
That said, I have to admit that the disk cache in Mac OS 8 feels a bit zippier than earlier disk caches. I notice a definite speedup with the disk cache set to 2,048K. Under System 7.1 and earlier versions, the speedup didn't feel as great.
For what it's worth, I'm leaving mine set to 2 megs (2,048K) for now and may even bump it up to 3 or 4 megs. Because I've got oodles of RAM (96MB!), that still leaves me plenty of RAM for applications, so I'm willing to trade a meg or two of RAM for the speedup. Once again, your mileage may vary.
It's not real, it's virtual (memory)
Virtual memory works better in Mac OS 8 than ever before.
The truth is that you should have enough real RAM to use your favorite application or applications (if you like to keep more than one program running) comfortably. You should have enough real RAM to open all the documents and programs you need.
If you can't afford that much RAM, consider Connectix RAM Doubler 2, which does what virtual memory does but does it better and faster without using any space on your hard disk, for about $50 (see the "RAM Doubler 2" sidebar). If you can't manage to find $50, virtual memory isn't that bad.
You access virtual memory via the Memory control panel, as shown in Figure 9-8. Just click the On radio button and use the arrows to the adjust the total amount of memory you will have after you restart your Mac. (Yes, you have to restart if you want to turn virtual memory on, turn virtual memory off, or change virtual memory settings. Sorry.) In Figure 9-9, after making the appropriate adjustments in the Memory control panel and restarting, my 96MB Mac thinks that it has 128MB.
Virtual memory works by setting aside space on your hard disk that acts as RAM. It actually creates a very big, invisible file on your hard disk equal to the amount of virtual memory in use plus all the installed RAM! So if you have a 32MB Mac and want to make it think it has 64MB using virtual memory, you'll have an invisible 64MB file on your hard disk taking up space. For me the cost is even higher -- I start out with a 97MB invisible file as soon as I turn virtual memory on.
Figure 9-10 shows how much hard disk space virtual memory is using on my Mac. Of course, I had to know that the file was named VM Storage in order to use Find File to show it, but that's neither here nor there.
So now you know that virtual memory eats up some hard disk space, but it does have some benefits. First, virtual memory lets your Mac think that it has more RAM than it actually does. This additional, almost magical RAM, is most effective in allowing you to run several small programs rather than one large program. Second, turning virtual memory on, even if you only set it to add 1 megabyte of virtual memory, allows many applications to run using less RAM on Macs with PowerPC processors.
Go back and take another look at Figure 9-4. See that little note at the bottom that says "Memory requirements will decrease by 3,918K if virtual memory is turned on in the Memory control panel"? It'll disappear (and Microsoft Word will require about 4MB less RAM to run) with virtual memory turned on. This tip alone makes it worth turning on VM even if you only set it to 1MB.
For what it's worth, programs also require less RAM under RAM Doubler 2.
RAM Doubler 2
If you need to have more RAM but can't afford the chips, then consider RAM Doubler 2, an alternative virtual memory program from Connectix Corporation. It installs with a single click and magically transforms your 8MB Mac into a 16MB Mac (or your 32MB Mac into a 64MB Mac, or whatever). Its speed is much better than that of Apple's virtual memory. It doesn't require a permanent, invisible file on your hard disk, and it works with almost everything virtual memory works with. It's kind of like virtual memory without any of the side effects.
I'd be remiss if I didn't mention that if any single program has its Preferred Size set higher than the amount of free RAM installed in your Mac, performance will more than likely be degraded. Even so, in the same situation, the degradation from Apple's virtual memory will likely be worse. While RAM Doubler 2 is pretty miraculous, even miracles have limitations.
If you like virtual memory, you'll like RAM Doubler 2 even better. Even if you hate virtual memory, you may like RAM Doubler 2. If you need more RAM but can't afford it right now, give RAM Doubler 2 a try. It's the next best thing to real RAM.
Better still, buy 32MB of real RAM. You'll feel better after you do.
Faster than a speeding bullet: it's a RAM disk
A RAM disk enables you to use part of your installed RAM as a temporary storage device, a virtual disk made of silicon. Using a RAM disk is much, much faster than any other kind of disk and, if you're using a battery-powered Mac, it's much more energy efficient.
Many Macintoshes include a RAM disk feature. To find out if yours is one of them, open your Memory control panel. If you see RAM disk controls like those shown in Figure 9-11, your Mac has the RAM disk feature.
Memory assigned to a RAM disk is not available for opening programs or loading extensions and control panels. So unless you have 32 or more megabytes of RAM, a RAM disk is probably not practical. Even with 32MB, it probably won't be that useful.
RAM disks are wickedly fast while you use them, but they are temporary. When you shut down your Mac (or if the power is interrupted to a non-PowerBook Mac), the contents of a RAM disk are wiped out. In addition, certain kinds of System crashes can erase a RAM disk's contents. The contents of a RAM disk do, however, survive a restart.
Even so, you should never store your only copy of a file on a RAM disk. If you save files on a RAM disk, make sure to copy them to your hard disk every so often -- just in case.
Creating a RAM disk
To create a RAM disk, click the On button in the RAM Disk portion of the Memory control panel (refer to Figure 9-11) and drag the slider to choose the percentage of the available memory that you want to use for your RAM disk. Close the control panel and restart your Mac. The new RAM disk appears on your desktop (see Figure 9-12).
Erasing a RAM disk
There are three ways to erase the contents of a RAM disk. One, of course, is to shut down your Mac. You'll see a warning that the contents of the RAM disk will be lost; when you click OK, it's gone.
You can also erase a RAM disk by doing one of the following:
- Selecting the RAM disk's icon and choosing Special-->Erase Disk
- Dragging everything on the RAM disk to the Trash and then choosing Special-->Empty Trash
Resizing or removing a RAM disk
To resize a RAM disk, use the slider in the Memory control panel to choose a new size; then restart your Mac.
The contents of a RAM disk are lost when you resize it, so copy anything important to your hard disk before you resize.
To remove a RAM disk, click the Off button in the Memory control panel and then restart your Mac. The RAM disk must be empty, or the Off button is disabled.
Good things to try with a RAM disk
Some applications run a lot faster when they're on a RAM disk. Copy your favorite game to a RAM disk and give it a try.
Your Mac runs screamingly fast if your System Folder is on a RAM disk. You need at least 16 megs of RAM to create a RAM disk big enough for your System Folder.
It is possible to use a RAM disk containing just a System and a Finder as your startup disk. It's not very useful, but it is possible. Here's how you do it:
- Create a RAM disk large enough to hold your System and Finder (about 10MB).
- Create a new folder on the RAM disk. Name it System Folder.
- Copy the System file and the Finder file from the System Folder on your hard disk to the newly created System Folder on the RAM disk.
- Open the Startup Disk control panel and click your RAM disk's icon to designate it as the startup disk.
- Restart your Mac.
Your Mac boots up from the RAM disk instead of your hard disk.
While this particular execution won't do much for you, if you have enough RAM to create a 15MB or 20MB RAM disk, you can add a few extensions and control panels to the System Folder on the RAM disk and have a relatively useful, blindingly fast startup disk.
Another thing to try is moving your favorite application to the RAM disk and running it from there. Many applications -- including Web browsers -- run significantly faster from a RAM disk. And storing your Web browser's cache of recently viewed pages on a RAM disk makes pages appear blazingly fast the second time you visit them.
And there you have it. More than you really need to know about RAM and your Macintosh!