10.6: Completely Disable Virtual Memory in Snow Leopard

Jun 08, '11 07:30:00AM

Contributed by: metiure

Snow Leopard only hintThis hint is the result of an experience I tried in the last few days. It involves disabling the dynamic pager daemon and stop using virtual memory at all in Snow Leopard. I don't recommend doing it in previous OSX versions, or if don't want to take risks. Advantages, in my case, are obvious, and, so far, with no issues at all.

My MacBook Pro, Core i5, 4 GB RAM, 320 GB HD, has been a real pleasure to use; my previous machine was an old PowerBook G4, as slow as you can imagine. But even with the MBP, some slowness seems to sometimes appear in everyday usage (Parallels 6/Windows7, Firefox, Photoshop, Mail, iTunes always opened), specifically related to the disk activity (a 5400 RPM 320 GB, Hitachi drive). I suspected the paging activities of OSX to be responsible for the general system slowdown. If so, no doubt the disk drive is the weak side of the MBP 2010, as everything slows down when OSX is creating a new swap file. So one move I planned was to buy a 7200 RPM drive, or even better, an SSD drive.

Meanwhile, I've been trying to minimize disk swap activity. Last week, I discovered this page at OSXDaily.com, where virtual memory is shown to be easy to disable in Snow Leopard. To disable it, the solution is quite simple. In Terminal, type this line and restart:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
To re-enable it, just repeat above command with the 'load' option.

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 how the whole system now 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).

So, if you have OSX 10.6 with as least 4 GB RAM, disable your virtual memory and rediscover your Mac.

[crarko adds: I haven't tested this one. I will echo Rob's advice from this previous hint; I do not recommend disabling the virtual memory subsystem on any version of Mac OS X. However, if you have sufficient physical RAM and want to eke out that last little bit of extra speed, you can try this at your own risk.]

Comments (39)

Mac OS X Hints