What is a safe amount of swap memory?

When opening an certain application and using it I have 5 Gigs of swap in use and I cannot find a consistent source where it tells me what amount is safe, one website said 10 and another less then one Gig can anyone give me more insight?

Mac mini, macOS 14.1

Posted on Dec 5, 2023 1:06 PM

Reply
Question marked as Top-ranking reply

Posted on Dec 6, 2023 5:22 AM

Healablesoda18 wrote:

When opening an certain application and using it I have 5 Gigs of swap in use and I cannot find a consistent source where it tells me what amount is safe...

It all depends on what you mean by safe.


Generally, any amount is "safe". The concern is what sort of hit you take on performance by using swap and with SSDs, high amounts of swap could mean additional wear and tear on the SSD to the amount of writes.


With the latest Mac, the SSD bandwidth is very high and an in general use one may not even feel any slowness due to it unless you are use some app that is very high performance and needs lots of RAM to achieve its high performance. Even then, performance may still be acceptable. In the days of the old spinning hard disk, when an app required swap, it would literally slow to a crawl. With modern Macs and SSDs, it isn't near as bad.


The real issue is the amount of writes to the SSD that swap generates. An SSD location can only be written to so many times before it will fail. SSD manufacturers will generally use a term called Maximum Terrabytes Written (TBW) which is a measure of lifetime and probability of failure. This number however was derived at in terms of what they will cover under their warranty. Much like a car, the manufacturer may have a warranty 75,000 miles but will generally run 100K, 200K or even more.


With that said, where it is problematic in modern Apple products, is the SSD is soldered to the logic board and if the SSD fails, the logic board needs to be replaced ($$$$$$$).


In conclusion, if you are continuously using large amounts of swap on a daily basis, then you really need to either minimize the number of concurrently running apps or replace the machine with more RAM for the way you use your computer. There are apps available that you can get that will track that total number of writes to the drive to see if there could be a problem in the long run (DriveDX comes to mind and an open source command line app smartctl), Unfortunately, Apple does not publish the TBW for the SSDs in Macs. So, you could get an app like DriveDX and run the demo for a month and see how much wear you are actually creating with the swap. Generally speaking, anything less than 40 GB/day and you will be more likely to get a new computer because it is outdated before you get into the gray area of SSD failure.


6 replies
Question marked as Top-ranking reply

Dec 6, 2023 5:22 AM in response to Healablesoda18

Healablesoda18 wrote:

When opening an certain application and using it I have 5 Gigs of swap in use and I cannot find a consistent source where it tells me what amount is safe...

It all depends on what you mean by safe.


Generally, any amount is "safe". The concern is what sort of hit you take on performance by using swap and with SSDs, high amounts of swap could mean additional wear and tear on the SSD to the amount of writes.


With the latest Mac, the SSD bandwidth is very high and an in general use one may not even feel any slowness due to it unless you are use some app that is very high performance and needs lots of RAM to achieve its high performance. Even then, performance may still be acceptable. In the days of the old spinning hard disk, when an app required swap, it would literally slow to a crawl. With modern Macs and SSDs, it isn't near as bad.


The real issue is the amount of writes to the SSD that swap generates. An SSD location can only be written to so many times before it will fail. SSD manufacturers will generally use a term called Maximum Terrabytes Written (TBW) which is a measure of lifetime and probability of failure. This number however was derived at in terms of what they will cover under their warranty. Much like a car, the manufacturer may have a warranty 75,000 miles but will generally run 100K, 200K or even more.


With that said, where it is problematic in modern Apple products, is the SSD is soldered to the logic board and if the SSD fails, the logic board needs to be replaced ($$$$$$$).


In conclusion, if you are continuously using large amounts of swap on a daily basis, then you really need to either minimize the number of concurrently running apps or replace the machine with more RAM for the way you use your computer. There are apps available that you can get that will track that total number of writes to the drive to see if there could be a problem in the long run (DriveDX comes to mind and an open source command line app smartctl), Unfortunately, Apple does not publish the TBW for the SSDs in Macs. So, you could get an app like DriveDX and run the demo for a month and see how much wear you are actually creating with the swap. Generally speaking, anything less than 40 GB/day and you will be more likely to get a new computer because it is outdated before you get into the gray area of SSD failure.


Dec 5, 2023 1:34 PM in response to Healablesoda18

In the Activity Monitor application click on the RAM tab and look at the little graphic in the bottom left corner. If it becomes red your swap file is too large! This gauge indicates Ram Pressure and the higher it is the worse the performance hit. The size of the swap file itself is one part, but not the only part, of Ram Pressure.

Dec 6, 2023 6:57 PM in response to woodmeister50

woodmeister50 wrote:

With the latest Mac, the SSD bandwidth is very high and an in general use one may not even feel any slowness due to it unless you are use some app that is very high performance and needs lots of RAM to achieve its high performance. Even then, performance may still be acceptable. In the days of the old spinning hard disk, when an app required swap, it would literally slow to a crawl. With modern Macs and SSDs, it isn't near as bad.


Another thing Apple has been doing is using compressed RAM.


Instead of swapping things out to the SSD or HDD, macOS may "swap" them out to compressed RAM. Doing compression ("swap out") and decompression ("swap in") burns CPU cycles, but in terms of the hit to overall system performance, can be cheaper than having the CPU sit around doing nothing, while waiting on a rather slow (by CPU/RAM standards) SSD, or an even slower HDD.


There's another benefit. To the extent that macOS can "swap" to compressed RAM instead of swapping to the SSD, this reduces wear and tear on the SSD.


Dec 7, 2023 5:20 AM in response to den.thed

Not quite correct, in current versions of macOS swap on disk dynamically changes as needed. I have verified that myself with Activity Monitor and when using an app that creates lots of swapping, I can see at times up to 6GB of swap space being used. I even see that amount go up and down during the course of this condition. When finishing up, closing the app and all the files worked on, that swap will drop down to a few megabytes. Regardless of any Mac I use and how much RAM it has, there is always a few megabytes that are always used.


What I think you may be referring to is RAM app caching where the Mac will keep apps in RAM in some form for fast re-launch. This use will not be released without a re-boot?

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.

What is a safe amount of swap memory?

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