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

otherguy5

macrumors member
Original poster
Feb 2, 2015
93
7
I just recently bought the Macbook Air with the M1 chip. It's awesome in terms of how smooth it runs, the long battery life, and... unlike my other Macbooks, it has yet to heat up due to even casual use. So I love it.

But I recently read about memory swap. Not too familiar with it, but I've recently been monitoring it. My question is... what is the normal amount of swap memory that one should see on Activity Monitor due to casual use?

I also notice something interesting... when I use Safari, my swap memory goes up to around 500 MB. Not a lot, I know. But compare this to when I use Firefox (set to not remember history), it remains at around 25 MB.

So yeah, I read it's no big deal because the SSD can last ab incredibly long time. But I just found that interesting.
 

MBAir2010

macrumors 604
May 30, 2018
6,975
6,351
there
I think Safari keeps more cache data than other web browsers, and there could be a setting in firefox that controls the data limit were that is set at say 325mb instead of unlimited.
 

glenthompson

macrumors demi-god
Apr 27, 2011
2,983
844
Virginia
If you have a lot of programs running the swap can be used for immutable memory items like code. If an active program needs more memory it can be given memory belonging to another program’s code. Since the code hasn’t changed it doesn’t need to be swapped out, saving writes to disk. When the other program needs to run that code it gets swapped in from the swap file. Performance really degrades when you continually swap memory blocks out and in.
 

James_C

macrumors 68030
Sep 13, 2002
2,845
1,896
Bristol, UK
I would not worry to much about swap memory usage. Mac OS will use Swap memory to move RAM memory that is not being actively used. It can be misleading to look at in terms of how much RAM your applications actually need. Memory Pressure is a better guide to the amount of available RAM to your system.

You are correct, SSD lifespan is linked to how many times data is written to the disk, however it used to be more of an issue in the past when SSD lifespan was more limited. Even with high SSD usage,modern quality SSD’s are likely to last as long as your Mac.
 
Last edited:

Fishrrman

macrumors Penryn
Feb 20, 2009
29,069
13,096
The m-series sub category at macrumors has a VERY long thread about this.
Seems that m-series Macs have inordinately-high amounts of disk swaps, literally terabytes in not much time at all.

My thinking on this (and I'm no expert) is that Apple's silence on this (at least so far) indicates that this is "an integral part" of how the new m-series design works, and that (from their viewpoint) it's both intentional and expected.

This is my opinion only. I could be completely wrong.

I don't have an m-series Mac.
But if I DID have one, the first things I'd do with it would be to disable VM disk swapping AND compressed memory.
And then I'd manage open applications so as not to overload the "live" RAM...
 

Boyd01

Moderator
Staff member
Feb 21, 2012
7,926
4,860
New Jersey Pine Barrens
Also a front page story on this issue. I wouldn't want to disable swapping without a clear understanding of all the implications.

 

Fishrrman

macrumors Penryn
Feb 20, 2009
29,069
13,096
Boyd wrote:
"I wouldn't want to disable swapping without a clear understanding of all the implications."

I realize this reply is a bit off-topic for this thread, but I've been running my Macs FOR YEARS this way, no problems, NO crashes.

The first one was (is) a 2012 Mini with 10gb of RAM.
The second (current) one is a 2018 Mini with 16gb of RAM.

I close apps I'm not using, and NEVER EVER use "tabbed browsing". I'm morally opposed to it...o_O
 

Toutou

macrumors 65816
Jan 6, 2015
1,082
1,575
Prague, Czech Republic
My question is... what is the normal amount of swap memory that one should see on Activity Monitor due to casual use?
I'd say that anything below 5 GB of swapped memory is fine. You can easily decide whether the number looks reasonable (like an amount of RAM) or unreasonable (like a telephone number).

Let's say your machine has 8 gigabytes of RAM. When your OS and apps need so much memory that it can't fit into your physical RAM the machine starts offloading the least used stuff onto your SSD. And that stuff is still roughly the same size, so 4 gigabytes of swapped memory is 4 gigabytes of RAM that wasn't available. That's a reasonable number, 4 gigabytes of memory is a value that some apps may reasonably use. You can open your video editing suite with a game (or other memory-heavy software) running in the background, you can have many tabs open in a browser. That happens.

Now if the machine shows 10 or 20 or more gigabytes of swap used, that's not very reasonable. You don't need that much RAM to run anything (and if you did, you would definitely know, and probably not be using a MacBook). That's a sign that some of the processes running is leaking memory (a type of bug, when a process doesn't "return" memory it doesn't use anymore to the OS).

But during normal usage, with the memory pressure indicator green, the amount of swap used is usually in the tens or hundreds of megabytes. My 16 GB machine is currently at 9 megabytes of swap with all my professional stuff running (IDE, database, application server, two browsers).
 

Basic75

macrumors 68020
May 17, 2011
2,053
2,406
Europe
it used to be more of an issue in the past when SSD lifespan was more limited
Actually it's the opposite. Early SSDs could do 100000 write cycles per cell. Modern consumer SSDs can hit 1000 if you are lucky. Fortunately wear-levelling has become improved, but it is what it is.
 

Basic75

macrumors 68020
May 17, 2011
2,053
2,406
Europe
Mac OS will use Swap memory to move RAM memory that is not being actively used. It can be misleading to look at in terms of how much RAM your applications actually need. Memory Pressure is a better guide to the amount of available RAM to your system.
I agree that the amount of swap used is not in itself indicative of a problem. If you have 10GB in your swap file without it being constantly read from or written to then it doesn't really matter much. But please don't say that swap is only used for "memory that is not being actively used". If your working set doesn't fit in RAM then the OS has no other possibility but to page out actively used memory, or even swap out entire processes.
 

Basic75

macrumors 68020
May 17, 2011
2,053
2,406
Europe
If you have a lot of programs running the swap can be used for immutable memory items like code. If an active program needs more memory it can be given memory belonging to another program’s code. Since the code hasn’t changed it doesn’t need to be swapped out, saving writes to disk. When the other program needs to run that code it gets swapped in from the swap file. Performance really degrades when you continually swap memory blocks out and in.
First, "lots of programs running" is hardly the yardstick, you might have one single application that uses more memory than is available thereby leading to paging and/or swapping (not that the latter would be of much use in this case).
Second, you first say that swap can be used for code and then contradict yourself in the next sentence where you, correctly, say that code doesn't need to be swapped [or paged] out: Memory pages containing code do not end up in swap space when they are evicted from memory since they can be reloaded from the (immutable) application binary at any time.
 

SjoukeW

macrumors member
Jun 8, 2020
66
62
Netherlands
The size of the swap is not important, whether it is 1GB or 30GB, you should see it as a parking lot for 'stuff in memory which is not needed'. When the data in the swap is needed it will be put into memory again, being swapped out with other stuff.
As long as all the frequently used data is in the RAM there is no problem.
The problem is when all the frequently needed data doesn't fit into ram, then it constantly changes the data in RAM with the swap. This causes slowdowns.
The amount of this 'swap activity' is on MacOS displayed with 'memory pressure'. When this turns orange some data is swapped in frequently. When it turns red you are hopelessly out of memory and experiencing severe slowdowns.
This can happen with 1 GB in the swap or 30GB in the swap. But that's completely dependent on your usage.

As long as you have idle unused programs in the background doing nothing, there is nothing wrong with a big swap.
Also reading from the swap frequently doesn't wear out the SSD, only frequent writing might cause some wear. With normal usage the SSD will easily outlive the Macbook.
 

Bento.Box

macrumors regular
Sep 10, 2022
224
121
The size of the swap is not important, whether it is 1GB or 30GB, you should see it as a parking lot for 'stuff in memory which is not needed'. When the data in the swap is needed it will be put into memory again, being swapped out with other stuff.

The size of the swap is important.
Basically, the amount of physical RAM plus the amount of swap configured must be higher than the total amount of RAM needed for your workload.

Swap to the OS is simply very cheap and slow memory, but data must be paged in/out to be handled.

OSX usually does a good job handling it, in contrast to Windows (which does a poor job) and Linux (where it's important to tune swap behaviour to your workload, or else you might get very disappointed).

In general, if you have enough RAM, you don't need swap. There more RAM you have, the less swap you need to configure.

Other technologies also help in reducing the amount of required physical memory for a particular workload:
- compression
- deduplication (especially useful in virtualized environments)
- overcommit (especially useful for dumb programmers, who allocate memory without ever using it)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.