OSX 10.5.7 Disabling virtual memory (SwapFile) Issue

Hi,
With OSX 10.5.6, disabling virtual memory (SwapFile) works very well using:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist

However, with OSX 10.5.7, I'm having weird issues like I can't repair permissions, BlueTooth does not start sometimes, is anyone else seeing this?

Thanks

MacBook Pro 17", Mac OS X (10.5.7)

Posted on Jun 13, 2009 1:40 PM

Reply
19 replies

Jun 13, 2009 1:50 PM in response to TamrSukary

My swapfile is 64 MB.
If you don't have sufficient RAM, only then will your swapfile actually be used. Preventing it from being used may have unexpected and/or unintended consequences.

Are you having many pageouts? If so, you have a problem.

Since my swapfile is never used, I have never seen a reason to disable it.
And if it were used, that would be less of a reason.

Message was edited by: nerowolfe

Jun 13, 2009 2:21 PM in response to TamrSukary

TamrSukary wrote:
Thanks for your reply nerowolfe.
I have enough RAM 4GB and never used it all at once. I don't see a lot of pageouts either, but the reason I want to disable the SwapFile is I have Intel SSD. I read SwapFiles decrease your SSD life.


Perhaps if they are used. But as I noted, my swapfile has never changed.
If you see any pageouts at all, that's a bad sign. It indicates that you are running out of RAM and using the HD for "RAM" which is not good and what you probably are looking to avoid.
Pageins are normal - they are apps that "might" be used again so they are stored on the HD ready to relaunch.
Pageouts however, as I noted, represent system memory being forced to use the HD after the RAM is filled up.

When I look at my activity monitor I see
Page outs: 0 bytes
Swap used: 0 bytes.

So, as I noted, turning off my swap would do nothing. It's not being used.
I suggest turning yours back on and then using the Activity Monitor to see if it's actually being used. If it is, you need more RAM.

Jun 13, 2009 2:40 PM in response to TamrSukary

I read SwapFiles decrease your SSD life.

where did you read that? that doesn't make any sense to me. this would only be an issue if a swap file is constantly being written to. In this case the correct solution is to get more RAM. if your swap file is not in use (and it shouldn't be if you have enough RAM) then it won't affect your hard drive one way or the other.

Jun 14, 2009 3:24 PM in response to nerowolfe

Here's a screenshot a few hours later:

User uploaded file

If what you posted applies to my situation, it would appear that something is either not right with the RAM, or perhaps the OS. About 2 weeks ago for an unrelated reason, I reinstalled the OS using Erase/Install, then manually moved software etc. from an external. Yet despite doing so it seems a new OS didn't affect what I've been seeing via Activity Monitor.

Jun 14, 2009 4:10 PM in response to Hawaiian_Starman

SSD life is reduced somewhat by writes, but surfing the web will cause far more writes to an SSD than swap ever will.

Disabling swap and Dynamic Pager is just asking for trouble.

Hawaiian_Starman, wheter page outs and swap usage indicates anything amiss is entirely depedent upon how you use your system; running applications that ask for large swaths of memory like Photoshop and Pro Apps will increase the amount of page outs more than running say, Terminal will. 🙂

Jun 15, 2009 10:03 AM in response to nerowolfe

nero,

Your note... "If you see any pageouts at all, that's a bad sign. It indicates that you are running out of RAM and using the HD for "RAM" which is not good and what you probably are looking to avoid."

Is absolutely wrong. It's not a bad sign. It's the system working as intended. Is paging stuff to disk slower than going to RAM? Absolutely. But it's not a sign of any problem. The system will rarely be up for multiple days with no page-outs; it just is impractical for people to run with 32 GB of RAM in their machines.

Jun 15, 2009 11:41 AM in response to William Lloyd

William Lloyd wrote:
nero,

Your note... "If you see any pageouts at all, that's a bad sign. It indicates that you are running out of RAM and using the HD for "RAM" which is not good and what you probably are looking to avoid."

Is absolutely wrong. It's not a bad sign. It's the system working as intended. Is paging stuff to disk slower than going to RAM? Absolutely. But it's not a sign of any problem. The system will rarely be up for multiple days with no page-outs; it just is impractical for people to run with 32 GB of RAM in their machines.


It's not a good sign, is it? Using the HD instead of RAM?
I am just trying to learn here.
Is this article in error?
http://www.thexlab.com/faqs/lackofram.html

Jun 15, 2009 11:47 AM in response to nerowolfe

Using the HD instead of RAM indicates the system is swapping information to disk. This is totally and completely normal on a modern system with virtual memory. There is no problem with this whatsoever; the system is designed to work this way.

The only issue with VM is that disk is slower than RAM, so if you are paging excessively, the system can slow quite a bit. The screen shots do not indicate this is a real problem.

Note, Activity Monitor's reporting isn't very good here. Top is much better (open Terminal, and type 'top'). Here's an example:

Processes: 83 total, 4 running, 2 stuck, 77 sleeping, 424 threads 11:45:44
Load Avg: 0.11, 0.19, 0.20 CPU usage: 1.71% user, 1.83% sys, 96.45% idle
SharedLibs: 6764K resident, 6588K data, 0B linkedit.
MemRegions: 25695 total, 2218M resident, 39M private, 522M shared.
PhysMem: 895M wired, 3021M active, 346M inactive, 4262M used, 3931M free.
VM: 177G vsize, 1041M framework vsize, 5595466(0) pageins, 19411(0) pageouts.
Networks: packets: 25639910/9705M in, 47504977/55G out.
Disks: 1271529/109G read, 2281325/104G written.


See that number before the pageouts? 19411(0). If the number in the parenthesis is high (say, 25 or 50) and stays that way for a long time, or if the number in front of the parenthesis is high (say, in the millions, or tens of millions), then it indicates your system could use more RAM. Again, it's not "bad" in the sense that "bad" indicates a potential problem; it's just that the system is regularly writing stuff to disk because there's not enough system RAM to hold everything in memory. Again this is totally fine, it's just the system will slow down.

Jun 15, 2009 12:11 PM in response to William Lloyd

If you read the OP's post, he is concerned with abusing his HD. He is trying to avoid using a swap and I pointed out that unless he also zeroed out any pageouts he would not be doing that which he set out to do.

Your comments, while interesting, are not related to the subject at hand and you might consider responding to the OP's question, not starting a new discussion about the age-old issue of pageouts and calling me wrong.
I stand by my statement and again refer to my reference
http://www.thexlab.com/faqs/lackofram.html

Jun 15, 2009 12:23 PM in response to nerowolfe

OK. So, in reference to the original question:

Does virtual memory "abuse" a SSD? It depends on what you mean by "abuse." When you page, with virtual memory, it will write to the disk. SSDs have a finite number of write cycles before they "wear out." So this could be a problem, right?

In practice, sophisticated wear leveling techniques in file system drivers do a good job distributing these writes to reduce this problem. Also, the number of writes is in the tens of thousands before this occurs. With wear leveling, this would take a VERY, VERY long time. So it's not really a practical issue -- turning off VM will not help with the SSD problem in any way, shape or form, as the number of writes is "in the noise" compared to the thousands of other writes the OS does constantly (for things like browser cache files, etc.). If you want to know how much the OS writes to disk, open up a terminal and type this:

sudo fs_usage

And type your admin password. Watch all the writes spool by.

I'm also really curious as to where the OP found this advice in the first place. I did Google search, and came across EXACTLY ONE article:

http://www.willreese.com/?p=29

Note the caveat:

"As long as your memory use remains below the amount of RAM in your machine, your system should function normally no matter how long you leave your applications open. However if you do use all your memory and your system is unable to swap, it is likely to crash and require a restart. If this happens, you should probably re-enable the dynamic_pager process by running the following command."

WOW. So you should run this command, which may crash the system and lose data, which would occur ANY TIME the system would page in the first place! This, my friend, is what is known as HORRIBLE ADVICE.

Look, I'm not trying to be a jerk. It's just that, the OP is using something that is dangerous and could well result in data loss and an unstable system to solve something that is not even a problem in the first place, as swap is not going to harm the SSD at all. Swap use (even highly excessive use, say 50x more than this poster would see), would take 50 years to wear out an SSD, while data loss is probably a week away with a system crash when the system tries to page.

Jun 15, 2009 12:49 PM in response to TamrSukary

Greetings,

Where did you see the part about wearing out your Intel SSD? The solid state drive isn't any more prone to wearing out than an ordinary hard drives is. We tested those drives before they went to market for over a year, and they are pretty decent drives, and we hammered them beyond belief.

As an engineer I can tell you that you will wear out the computer long before the SSD goes, unless it suffers a catastrophic failure like a electrical storm and it fries.

You need the swap file, don't worry about a few writes here and there.

Cheers,
M.
*****

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

OSX 10.5.7 Disabling virtual memory (SwapFile) Issue

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.