Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

w00t951

macrumors 68000
Original poster
Jan 6, 2009
1,834
53
Pittsburgh, PA
I've noticed that Mavericks seems to swap out to the disk when it doesn't need to - memory pressure is a low linear line, and I've got 6.03GB/16GB used, with 277.8MB of swap used.

According to this article, however, Mavericks isn't supposed to use swap memory unless you overrun your physical installed memory by several GB's.

Can someone explain to me why swapping to the disk is preferable to keeping it all in RAM? Even with a PCIe SSD RAM is still thousands of times faster in read/write speed and latency. I'm barely using my RAM and OS X is still swapping out to the disk.

Thanks.
 

FreakinEurekan

macrumors 603
Sep 8, 2011
5,529
2,586
I sometimes see a small amount of swap like that - never seemed to cause problems. I ignore it unless it gets to 1GB or so.
 

w00t951

macrumors 68000
Original poster
Jan 6, 2009
1,834
53
Pittsburgh, PA
I sometimes see a small amount of swap like that - never seemed to cause problems. I ignore it unless it gets to 1GB or so.

It's not the space that's the problem, it's the constant writing to the SSD. Solid state mediums have limited write/read capacity, and if the OS is unnecessarily swapping out to the disk it will shorten its lifespan.
 

dmccloud

macrumors 68030
Sep 7, 2009
2,969
1,689
Anchorage, AK
It's not the space that's the problem, it's the constant writing to the SSD. Solid state mediums have limited write/read capacity, and if the OS is unnecessarily swapping out to the disk it will shorten its lifespan.

This shortened lifespan issue has been debunked on multiple occasions. While it was true for first generation SSDs, modern SSDs can last longer than the machines they're being used in. Testing has shown that even smaller SSDs can easily last 5-10 years through normal use (longer than most systems will be usable for), if not longer.

SSD Life Expectancy Tested (Anandtech)

Here is a graphic from the Anandtech article showing the lifespan of a couple different types of SSD assuming 10GB of data per day is written to the drive. Obviously, that will change if you write more or less data on a daily basis:
 

Attachments

  • Screen Shot 2014-05-10 at 2.32.14 AM.jpg
    Screen Shot 2014-05-10 at 2.32.14 AM.jpg
    96.4 KB · Views: 160

yjchua95

macrumors 604
Apr 23, 2011
6,725
233
GVA, KUL, MEL (current), ZQN
It's not the space that's the problem, it's the constant writing to the SSD. Solid state mediums have limited write/read capacity, and if the OS is unnecessarily swapping out to the disk it will shorten its lifespan.

Swapping a gigabyte or two a day isn't much, but if it swapped well over 10GB, I'd be worried.

I remembered in a thread that I created, there was an errant feature in a software on my system that kept writing to my SSD (although it didn't use any swap). I have since disabled that feature.

Anyways, here's a screenshot of my Activity Monitor (rMBP 13", 2.8 i7/16/512, 5h 25m since boot up). Workload was just Safari, Word, Spotify and Preview.
 

Attachments

  • Screen Shot 2014-05-10 at 19.27.57.png
    Screen Shot 2014-05-10 at 19.27.57.png
    496.1 KB · Views: 213
  • Screen Shot 2014-05-10 at 19.30.46.png
    Screen Shot 2014-05-10 at 19.30.46.png
    484.8 KB · Views: 186

h9826790

macrumors P6
Apr 3, 2014
16,614
8,545
Hong Kong
I don't 100% sure it's normal or not.

I've seen similar question in somewhere. On a 16G RAM MacBook, no memory pressure, but a 238MB swap file created and stay there until reboot.

Most user suggest that unless the swap file size keep increasing, otherwise nothing to worry about. This is inline with the Apple's suggestion (you need more RAM when memory pressure shows red and swap file size increase).

And someone suggest that it may be a normal system activity, nothing related to the real swap usage. However, due to the system register those activity as swap file usage. The number just stays there.

As far as I know, the swap usage will register ALL page in and out. 277.8MB is really nothing to worry about, and it is virtually doing nothing to the SDD ware.

If you think that the system may keep read / write that 277.8MB swap file. That's not the case. Lets say the system crate a 100MB swap file, and then the system fully rewrite that 100MB file another 9 times, you may see the "swap used" shows 2000Mb in Activity Monitor (1000MB write and 1000MB read).

Anyway, if you really very very care about that extra writing to your SSD, may be you can crate a RAM disk to replace the var/vm/ folder. But personally I won't recommend this, because it may destabilise the system in some situation.
 

w00t951

macrumors 68000
Original poster
Jan 6, 2009
1,834
53
Pittsburgh, PA
I haven't had any Swap Used since I rebooted, so I think it was a bug.

And regardless of the durability of SSDs (those are merely projections; SSDs are so new that many questions go unanswered about true durability), it's still not something that should be happening.
 

maflynn

macrumors Haswell
May 3, 2009
73,448
43,369
When in doubt reboot.

Could it be a buggy app with a memory leak?
 

h9826790

macrumors P6
Apr 3, 2014
16,614
8,545
Hong Kong
I've just intentionally run photoshop intensively (plus allow it to use 100% of RAM) to use up all the 32G RAM in my Mac. I monitor the swap usage through out the test, end up I have the following result.

Screen Shot 2014-05-13 at 15.53.39.png

The system squeezes out another 8G of RAM by compressing it. And push the virtual memory to 48G, but still have no swap usage.

It seems Mavericks handling RAM really well. And won't touch the swap file unless it really required to do so. Therefore, I am quite sure that 2xxMB swap in your case is not a real swap by Maverick. It may occasionally happen, we don't know is it cause by memory leak of some other software. However, it shouldn't because of Maverick don't know how to use the RAM properly.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.