Technology in terms you understand. Sign up for the Confident Computing newsletter for weekly solutions to make your life easier. Click here and get The Ask Leo! Guide to Staying Safe on the Internet — FREE Edition as my thank you for subscribing!

How Much of the Swap File Actually Gets Used?

Question: Leo, I’ve been wondering how much of the swap file gets used when you have 16 or 32 GB of memory. I have been in the habit of placing the swap file and Lightroom's cache on an SSD to improve speed. But I’ve been wondering whether the swap file should go on another hard disk drive, especially if it doesn’t get used much.

Unfortunately, there is no general answer to say how much of the swap file is going to be used. It depends entirely on the software that you’re running, what your system's own memory requirements are, and how much software you’re running.

For example, if I’m just running a web browser and a couple of other things on a machine with lots of RAM, my system may not be using the swap file at all. On the other hand, if I’ve got Photoshop, a video editor, and a virtual machine or two running, then the memory requests of the system may be high enough that it’s going to start using the swap file.

So, I can’t answer your question, specifically, but I can review some of the things that factor in.

Become a Patron of Ask Leo! and go ad-free!

How much memory is enough?

These days, 16 GB and 32 GB are a pretty sizable amounts of RAM. Unless you're doing something extraordinary there’s a good chance that you’re not using the swap file at all.

If that's the case I actually recommend setting the swap file size to zero. There’s nothing that says you must have a swap file. It’s only a technique that's used in case you don't have enough RAM to run all of the software you're trying to run on your machine.

No Paging FileThe only downside is if you actually do run out of memory. That can happen if you're running a lot of different programs on your system at once, and those programs are attempting to use more RAM than is actually available. In that case your system may slow down, and you’ll get an out-of-memory message from one or more of the programs.

Swap files on an SSD

Now, let’s talk about where the swap files should live. I understand the performance benefits of having your swap file on a solid state drive. SSDs read very quickly. They’re not usually a big improvement in write speed, but they are a serious improvement in read speed.

But SSDs use flash memory, which as we know has a limited life span, depending on how much you write to it. By paging a file onto an SSD, it’s possible that you’re shortening the life of the drive itself. The question is, is the life being shortened by an amount that you'd eventually notice or care about?

SSDs actually use fairly high quality flash memory, so it's very possible that it would make for a fine swap file location. In your case with the amount of RAM you have, you may not be writing a lot to it anyway.

In my case, I’m running on a machine with an SSD. I put my swap file on one of the actual hard drives in that machine simply because:

  • It’s not going to get used very much. I have a fair amount of RAM.
  • If it does get used, I don’t want it (especially if used heavily) to shorten the life of my SSD.

That’s the option that I took. I'll suggest doing the same in your case as well.

Do this

Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.

I'll see you there!

3 comments on “How Much of the Swap File Actually Gets Used?”

  1. I think one reason some people are afraid to operate without a swap file is because in the old days running without a swap file was more dangerous and could potentially render your system unbootable if there wasn’t enough RAM to boot your computer. Now that even minimum RAM installations are enough to boot your computer and run a few small applications, the worst that could happen is that the computer could crash and you’d have to install a swap file to correct this problem.

    Reply
  2. Very good advice. It has focussed my mind on a few things. Both system drives are SSD.
    The 16GB PC was mine and I am not a heavy user. I will change the location of my swap file thus freeing up a SATA port for something else which I really want. Currently using an excess 150GB Raptor drive as the swap.
    The 32GB PC is my wifes and she is a heavy Photoshop user. Likewise I will shift her swap file off her second SSD. This SSD is also used for Lightrooms database and Bridges cache and gets backed up nightly.

    Reply
  3. The idea of not placing the swap file on your SSD doesn’t make any sense to me.
    If the swap file doesn’t get used very much, there is no problem.
    If the swap file does get used a lot, by putting it on a slower drive, you take a performance hit.
    If you’re willing to take a performance hit, why did you buy an SSD in the first place?
    You can make the whole computer system last a lot longer if you just put it back in the box and don’t use it.
    The price of SS drives is dropping. I suspect that in many cases by the time the SSD had a problem from overuse it would probably be too small for your needs and you’d be ready to replace it anyways.
    I would think that a better solution would be to max out the amount of ram in your computer to minimize swap file usage or as Leo says, shut the swap file off.
    If you are really worried about writing too much to an SSD, don’t buy one. Who is to say that the software that you use on a regular basis doesn’t write heavily to the disk?

    Reply

Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.