Tracking swap space: is it wearing out your SSD?

When your current Mac dies and goes for recycling, the most likely cause will be failure of its logic board, as it’s generally the most expensive component. The logic board of most modern Macs includes its chip or chipset, memory and internal SSD. While predicting the working life of most components isn’t possible, the one we can estimate is that for the SSD. This is because SSDs can only write to their memory a set number of times before they stop working: if you know how many times that is, then you can measure how much of its lifetime is remaining in an SSD, a feature provided by apps like DriveDx.

It turns out from reports of many users that even the most industrious of us don’t write enough data to the internal SSD of our Macs to wear them out over their normal expected lifetime of around ten years. At my current level of SSD use, this iMac Pro should be good for another 50 years or more.

However, one factor can greatly increase the quantity of data written to a boot SSD: excessive use of ‘swap’ space by virtual memory. In extreme cases, this could run an SSD into the ground in less than five years, thus sending that Mac to an early grave. This article looks at how you could detect this on your Mac’s internal SSD.

Swap used

Total write figures from DriveDx and similar utilities are good for giving the overall picture, but don’t tell you what was responsible for the total amount of data written. To separate what’s the result of swap usage you need to look deeper at memory use. This is shown in Activity Monitor and the size of the VM volume in your boot volume group, shown by selecting its container in Disk Utility. When there’s no swap use, that VM volume should be tiny, less than 1 MB. In the Memory tab of Activity Monitor, the figure for Swap Used should be zero.


Those only tell you the current amount of swap in use. To get a fuller picture over time, you’ll need to resort to Terminal’s command line, and the command vm_stat, which reports swapins and swapouts. These get a bit more complicated.

vm_stat can be used in either of two ways. When used without options, it gives a set of statistics for virtual memory use since that Mac last started up; when used with options to obtain multiple samples, the first gives total use since reboot, then subsequent figures are changes since the last set. For these purposes, simply entering the command
shortly before you shut your Mac down or restart it will give figures at the end for swapins and swapouts, in my case
Swapins: 0.
Swapouts: 0.

Used with the options
vm_stat -c 1 1
you’ll also get a single list, this time squeezed into two rows, containing at the end
swapins swapouts
0 0

By convention, swapins are pages of memory retrieved from VM storage to physical memory, and swapouts go the other way, from physical memory to VM storage. Read man vm_stat and you’ll become confused, as that defines them as:

  • Swapins: the total number of compressed pages that have been swapped out to disk.
  • Swapouts: the total number of compressed pages that have been swapped back in from disk.

which is the other way around. Looking at Apple’s open source code, it appears that this is a documentation error, and what you should be interested in are swapouts rather than swapins. Perhaps it’s simplest just to take the larger value.

Figures given aren’t in bytes, but pages. At the head of each set of results, vm_stat should report pagesize, the size of pages in bytes, which does differ between Intel Macs (4096 bytes) and Apple silicon models (16384 bytes), and can be obtained separately using the pagesize command if you want to check. To work out the total swapped out (or in), simply multiply the number of pages given, by the pagesize.

Keep a record of daily swap totals, and you can then set those against reported total data written to that SSD. If the amount written by swap is less than 10% of the total data written, then swap use is contributing little to SSD wear. If it’s 50% or higher, then having more physical memory would significantly reduce SSD wear. If the amount used for swap is prematurely ageing your Mac’s SSD, try increasing the amount of physical memory in your next Mac, as that should prolong its working life.