This method works for all computers on Snow Leopard, Lion and Mountain Lion
If you want to cut to the chase, just read the last quote.
I have a MacBook Pro with 4 GB of RAM. That's the most it can take. I've been experiencing the spinning beach ball, quite a lot, which may be aggravated because I tend to leave a number of applications running at once and have a number of menubar items and pre-loaded utility applications running in normal everyday use. I don't like running just one application at a time. I've now also got a Mac Mini which has 8 GB of RAM, and I have found that even though it is less likely to hit the buffers, it too can slow down when there is little free memory. These slowdowns are always associated with continuous disk access.
Very recently I came across this article on the web, and it struck a strong chord with me.
Something is deeply broken in OS X memory management
For a very long time I've noticed that my computer can slow down dramatically when switching applications, or even Safari pages for example. This happens after a period of time since logging in, and is accompanied by lots of disk activity. Since I keep a moving-graph display of memory use in my menubar, it's easy to see that this also is related to when the memory appears to be full or nearly full.
As a background to this, it's probably useful to understand a bit about how memory is managed in OS X. If you open
Activity Monitor and select the memory display, you can see that it defines four different types of memory.
There's "wired" memory, active memory, inactive memory and free memory. The total of these four items equals installed memory size. Wired memory is used by the system and is defined as stuff that doesn't get written to disk by the computer. Active memory contains data that is currently in use by the various applications and processes running on the computer at the moment. Inactive memory contains data that has been used in the past but is retained because it may be called upon in future - and it would be quicker for the computer to use this data in memory than it would be to re-read it from the disk. (In theory)
The rest of the contents of memory is called "free" memory, and that's just what it says.
But OS X can sometimes gets bogged down if there is not sufficient memory available instantly, and when this happens the computer grinds to a halt while it reads and writes data to disk. If this takes too long, over a few seconds or so, the computer then displays the spinning beach ball and it may say that an application has become "unresponsive".
You can mitigate this by having lots of memory installed in your computer and by closing applications that you don't need to have open. Another important factor is to have a reasonable amount of free space on your hard disk for the system to use for temporary storage.
As the Mac operating system has developed - from Leopard to Snow Leopard to Lion and now to Mountain Lion, the requirements for memory get ever larger. A way to keep this under control is to close applications when you don't need them, although even doing that does not necessarily always release it's data immediately from the inactive memory. Running multiple applications without having to close and open them again all the time is all part of the benefits of using a multitasking operating system. This is why OS X has built in "dynamic paging" which is designed to intelligently save data to disk when appropriate while still trying to keep as much useful data in memory is possible, to allow fast access to it when required by the applications you're running.
But it seems that the design of the dynamic paging system may not be as smart as it ought to be. Apple should spend some time to overhaul the dynamic paging system, it's long overdue, imo.
However...
There is a magic answer!
This article explains it much more eloquently than I can, and does provide an answer - at least a temporary answer.
Quote:
Ive been doing some investigation into what appears to be a huge problem with memory management in Lion (I, but not everybody, have seen this going back to Snow Leopard, though its worse in Lion.
The main symptoms that weve encountered:
• Frequent beachballs, particularly when switching applications and sometimes even tabs.
• General overall slowness and poor UI responsivness.
• Specific and drastic slowdowns on every Time Machine run.
• High memory utilization in Safari Web Content, mds, and kernel_task processes.
• Large numbers of page outs even with a good deal of available RAM.
• High amounts of RAM marked as inactive which is not readily freed back to other applications, with page outs favored.
There are interesting links about this problem at the end of the article. I found it fascinating reading.
The simple answer he proposes is to turn off dynamic paging. This is easily done with a straightforward Terminal command. It stays set that way through reboots. I tried it and everything now flies on my computer. That's not to say I never get the beachball, if I really push it hard by loading lots and lots of things, the beachball situation reoccurs - but for the most part the computer zips along - I think it's worth giving it a go. I also discovered that, in extremis, the computer will actually re-enable dynamic paging by itself if it's really pushed to it, but this normally doesn't happen.
Mac OSX Hints wrote:
The difference for me was quite impressive and immediately perceptible. As soon as I disabled the dynamic pager daemon, I restarted and notice a huge difference on how fast any application opens, that Windows 7 (in Parallels) reacts almost natively, and now the whole system feels so much more responsive. I would estimate the difference is about 20-30% between enabling and disabling VM. Win7 launches in about 20 secs, even Firefox opens and responds much faster than before.
No swap files in /private/var/vm, 0% cache hits and about 800-900 MB RAM still free (3 GB used) during peak usage.
I can testify that, after a week of tests, having opened as much as 30 simultaneous applications (in fact all the Apps folder), I have notice no slowdown, no bug, no kernel panics, no unusual log file error reporting. I tried running some PC game demos in Parallels/Win7 (with 2 GB RAM allocated). There was still no panic, no issues. I was working at my academy this week, using Windows servers, online printers, and virtual private networks, with no issues at all. The MBP is okay, except faster than before (and even faster when waking from sleep).
Try it, you might like it!
Quote:
I cant recommend this as a long term solution - Apple should fix this - but in the meantime, it seems to be having great results for me. Heres how much of a difference it is: I was going to turn it back on to collect some comparative numbers for this post, but I couldnt bear to cripple my machine again.
To deactivate the dynamic pager:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
followed by a reboot. You can turn it on again with
sudo launchctl load -wF /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
NB: You can always re-enable dynamic paging at any time with the second command.
About Terminal
• You can copy/paste a command directly onto the command line and then press return to execute it.
• These commands require you to supply an admin password.
• The first time you invoke sudo, you will be asked if you really mean it!
• The password does not appear on the screen as you type it, which can be a bit confusing at first.
• You can use the up/down arrow keys to cycle through previously entered commands, to save you time.
Ramaprem wrote:
It's very attractive, though, and would like to see more of it. Please advise.
Here we are, Ram -
Bookmarks