About memory management in OSX 10.9 Mavericks
Memory is managed differently, and more efficiently in 10.9. It is (mostly) unique in the industry, but may become trend.
Let’s start with the basics. Mechanical disk drives are very slow, with access speeds in the 10s of milliseconds and transfer rates in the 200-400 Mbps range real world. SSDs are much faster, on the order of a couple of ms access and typically 1200-3000 mbps transfer rates. RAM is much faster than either, in the nanosecond access and transfer speeds of ~8 Gbps effective (1 GHz x 8 bits/byte).
These are rough numbers for comparison purposes only.
So the goal is to keep as much in RAM as possible. But if you run out of RAM what do you do?
Traditionally you take the least used RAM and write it to a special part of the disk, in a way that you can access it most efficiently - minimizing the disk delays. This is called a swap file because you swap RAM in and out of it.
10.9 has a new trick: it compresses RAM using the main processors. Rather than swapping stuff to disk (disks are slow), it actually uses the processor to compress memory and make, for example, 1 GB of physical RAM hold as much as 1.5GB. Similar approaches are used to make MP3 files 10x smaller than the real thing - there is redundancy in data and you can take advantage of that. Apple is making the following calculation: the processors can compress way faster than the disk can swap. And its also predicting that the processors are often partly idle - waiting for swap files or disk access. So rather than swap files around, its compresses the files ***in RAM***.
Compression works,. Tests show that on average it is faster, and that 4GB (i have 4 GB RAM) acts like 5 1/2 - 6GB. Wow.
So, 10.9 will load up most of your RAM, knowing that it can compress some when it needs to. So don’t worry too much that it may look like all your RAM is taken - yea, it is, but its OK.
The measures to look at are:
1. amount compressed. Compression means it has run out of RAM and needs more. As long as compression is low this is fine. In fact this is how 10.9 uses RAM more efficiently than 10.6,7 or 8. Contrary to common wisdom, it requires LESS RAM than 10.8. The colored indicator tells you who this is going - green (good), yellow( iffy) and red (bad).
2. amount swapped. Once it cannot compress any further, or can’t do so efficiently, jot begins old-fashioned swapping. This is a major slow-down and means you would benefit from more RAM. Tiny amounts are OK.
here's an article by Apple - but on th pre-10.9 memory management techniques....mostly still true, but read on.
http://support.apple.com/kb/HT1342?viewlocale=en_US
Bottom line - compression makes 10.9 use RAM more efficiently than previous OSX versions. It also makes the “ram used” indicator less meaningful, and mans you should monitor “compression” .
That said, RAM has always been one of the most cost effective upgrades possible. People spend too much on new machines and too little on more RAM.
Hope this helps,
Grant