Loading page content
Page content loaded
Question marked as Top-ranking reply
User profile for user: IdrisSeabright
IdrisSeabright
User level: Level10 164,345 points
Dec 5, 2023 1:16 PM in response to Healablesoda18
Generally, you should leave the Mac to handle this itself.
Link
User profile for user: woodmeister50
woodmeister50
User level: Level7 20,233 points
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.
Link
User profile for user: Servant of Cats
Servant of Cats
User level: Level6 13,161 points
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.
Link
User profile for user: woodmeister50
woodmeister50
User level: Level7 20,233 points
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?
Link
User profile for user: dwb
dwb
User level: Level7 33,070 points
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.
Link
User profile for user: den.thed
den.thed
User level: Level10 80,140 points
Dec 5, 2023 2:06 PM in response to Healablesoda18
Swap use is an accumulative number that resets when you restart the Mac.
To check your current RAM usage, see > View memory usage in Activity Monitor on Mac - Apple Support
Link