Very high swap usage

hordur

macrumors newbie
Jun 23, 2010
7
4
0
I have a late 2013 model 21.5" iMac with 16GB ram running OS X 10.11.4. I'm having this problem that it is consistently allocating up to/close to 32GB of swap. There are not many swap-outs, so I guess this is not having much impact on performance, but it seems like all applications are just allocating memory out of control. This is also causing 32GB of my 250GB SSD to be occupied by some ******** that is never used and I've been getting low disk space warnings. I have not experienced this with my MacBook Pro or previous Macs I had.

In order to try to remedy the problem (and another one which I'll describe at the end of the post) I set up OS X on a new SSD and did not do any migration from the old drive, but now the problem is back again.

Looking at Activity Monitor, here are some values from the "Memory" column:
Photoshop CC: 4.03GB (no file open)
Dropbox: 4.00GB
Skype: 3.73GB
Finder: 3.67GB (single window open)
Notification Center: 3.57GB
Dock: 2.97GB
Google Chrome: 2.95GB
CrashPlan menu bar: 2.56GB
loginwindow: 2.51GB
Lightroom: 2.51GB
iTerm: 2.50GB (single terminal open)
Flux: 1.31GB

I find it especially strange that Notification Center, Dock and loginwindow are allocating so much memory.

If anyone has some suggestions, explanations or remedies for this problem, they would be greatly appreciated.

*the other problem I was having was that Adobe Photoshop was always using at least one full CPU core, even when it had no file open.
 

Fishrrman

macrumors P6
Feb 20, 2009
16,982
5,448
0
Here's a suggestion I'll offer.
Others will tell you NOT to do this.
I've been running my Mac Mini using this trick for months and months, never a crash.

DISABLE VM swapping (page ins and page outs).
Use this terminal command to do it:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist

password and restart required.

Then, use this command to check that VM is disabled:
sysctl vm.swapusage
If VM is off, report should be:
vm.swapusage: total = 0.00M used = 0.00M free = 0.00M

To remove the swapfile, use this:
sudo rm /private/var/vm/swapfile*

To RE-ENABLE disk swapping, use this:
sudo launchctl load /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist

TRY THIS.
It will hurt nothing.
If it doesn't work, just re-enable swapping.

But ... it may give you better performance than you're getting now.

My opinion only.
Others will disagree.
Some will disagree vehemently.
 

Weaselboy

Moderator
Staff member
Jan 23, 2005
28,911
8,670
0
California
I have a late 2013 model 21.5" iMac with 16GB ram running OS X 10.11.4. I'm having this problem that it is consistently allocating up to/close to 32GB of swap.
Do not bother with the suggestion in post #3. That does not fix the problem, it only masks the problem by disabling the swap file.

Was there some point in time where this was not occurring? Can you think of any app or utility you may have installed that coincided with when this started?

Just as a test, try holding the shift key when booting to start in safe mode. That will prevent all startup and launch items from running. If this does not happen in safe mode, then that tells you it is some startup or launch item causing this and we can then try to figure out which item is the problem.
 
  • Like
Reactions: jgelin and chrfr

hordur

macrumors newbie
Jun 23, 2010
7
4
0
Do not bother with the suggestion in post #3. That does not fix the problem, it only masks the problem by disabling the swap file.

Was there some point in time where this was not occurring? Can you think of any app or utility you may have installed that coincided with when this started?

Just as a test, try holding the shift key when booting to start in safe mode. That will prevent all startup and launch items from running. If this does not happen in safe mode, then that tells you it is some startup or launch item causing this and we can then try to figure out which item is the problem.
I'm not 100% sure it didn't happen before, but I suspect it didn't as I had never noticed it. No, can't think of any app that could be the culprit and if it was caused by one, I guess I've reduced the set a lot since I set the computer up from scratch again, only installing a subset of what was in there before. I'll try the safe mode and see if it happens there as well.
 
  • Like
Reactions: Weaselboy

throAU

macrumors 603
Feb 13, 2012
5,239
2,247
0
Perth, Western Australia
I'd say google hangouts is probably a contributor to this.

If your machine is swapping that hard, the root cause is a memory leak from an application.

Killing swap is not a fix.
 

chrfr

macrumors G3
Jul 11, 2009
8,056
2,443
0
It just keeps getting better and better, now I got a warning that the system was out of memory and saw that the total allocated swap was >56GB!
What do you have in Notifications? That 8GB+ it's using is certainly very abnormal. On my system here it's using 20MB; on another of my computers it's using 46MB. It looks like you have a fairly large number of login/startup items running so I'd try disabling those and testing to see if the memory usage goes down.
I also agree that disabling swap is of no value and just masks whatever the real problem might be.
 
  • Like
Reactions: Weaselboy

Fishrrman

macrumors P6
Feb 20, 2009
16,982
5,448
0
OP:

As I said in the second line of my post #3, others will -- and have -- told you not to try my suggestion.

And I will repeat:
If nothing else works, give it a try.
You may be surprised at the results....
 

Mr. Buzzcut

macrumors 65816
Jul 25, 2011
1,037
486
0
Ohio
OP:

As I said in the second line of my post #3, others will -- and have -- told you not to try my suggestion.

And I will repeat:
If nothing else works, give it a try.
You may be surprised at the results....
He doesn't have enough physical memory. First few apps in the process list need to be looked at.
 

hordur

macrumors newbie
Jun 23, 2010
7
4
0
What do you have in Notifications? That 8GB+ it's using is certainly very abnormal. On my system here it's using 20MB; on another of my computers it's using 46MB. It looks like you have a fairly large number of login/startup items running so I'd try disabling those and testing to see if the memory usage goes down.
I also agree that disabling swap is of no value and just masks whatever the real problem might be.
I have not touched notifications since I reinstalled MacOS so it has no widgets except the default ones and it has a few notifications listed.

Don't think this is such a large number of startup items:
- iTunesHelper
- witchdaemon
- CrashPlan
- Alfred 2
- Dropbox
- Insync
- iStatMenus
+ some Adobe creative cloud stuff

I also had f.lux on that list, but I've disabled it now as it is the first one on my list of suspects. Let's see what happens.
 

Weaselboy

Moderator
Staff member
Jan 23, 2005
28,911
8,670
0
California
OP:

As I said in the second line of my post #3, others will -- and have -- told you not to try my suggestion.

And I will repeat:
If nothing else works, give it a try.
You may be surprised at the results....
The guy has freakin' Finder using 3.67GB of memory. Something is seriously wrong here and disabling the swap file is not going to fix it.
[doublepost=1460847409][/doublepost]
I have not touched notifications since I reinstalled MacOS so it has no widgets except the default ones and it has a few notifications listed.

Don't think this is such a large number of startup items:
- iTunesHelper
- witchdaemon
- CrashPlan
- Alfred 2
- Dropbox
- Insync
- iStatMenus
+ some Adobe creative cloud stuff

I also had f.lux on that list, but I've disabled it now as it is the first one on my list of suspects. Let's see what happens.
There are several places launch items can be. Not just that login items list in Users & Groups. Try the safe mode boot I suggested just as a test to see if that fixes it. If it does we can start trying to help you figure out which launch item is causing this.

In addition to the startup items, launch items can also be in these folders.

Code:
~/Library/LaunchAgents
/Library/LaunchAgents
/Library/LaunchDaemons
/Library/StartupItems
 
  • Like
Reactions: throAU

hordur

macrumors newbie
Jun 23, 2010
7
4
0
Ok, f.lux seems to be the culprit. Removed it from startup, rebooted and ran the computer for a few days, no abnormal memory buildup, everything OK. This morning, I run f.lux and check on the computer 9 hours later: 13GB in swap, bunch of applications using it.

Screenshots of activity monitor right after I started f.lux and then another one 9 hours later:
https://www.dropbox.com/s/00w547x5c28tg55/Screenshot 2016-04-20 08.47.31.png?dl=0
https://www.dropbox.com/s/j04jlxppzklwz41/Screenshot 2016-04-20 17.53.41.png?dl=0
 

throAU

macrumors 603
Feb 13, 2012
5,239
2,247
0
Perth, Western Australia
Interesting.

I'm an f.lux user here and haven't noticed the swap growing....

Sounds like perhaps you may have uncovered a driver memory leak or something, i'm on intel HD6100 here, what GPU is in it?
 

chrfr

macrumors G3
Jul 11, 2009
8,056
2,443
0
Ok, f.lux seems to be the culprit. Removed it from startup, rebooted and ran the computer for a few days, no abnormal memory buildup, everything OK. This morning, I run f.lux and check on the computer 9 hours later: 13GB in swap, bunch of applications using it.
You should view the memory usage in Activity Monitor with "all processes" rather than "my processes." This will likely be more helpful in verifying whether or not it's really f.lux by showing you everything that's running.
All of that swap is not necessarily a performance problem, as long as you aren't getting the out of memory errors. The Memory pressure is still green and there's RAM left to use.