Technology in terms you understand. Sign up for my weekly newsletter, "Confident Computing", for more solutions you can use to make your life easier. Click here.

How Much of the Swap File Actually Gets Used?

//
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.

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.

  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.

  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?

Leave a reply:

Before commenting please:

  • Read the article. Comments indicating you've not read the article will be removed.
  • Comment on the article. New question? Start with search, at the top of the page. Off-topic comments will be removed.
  • No personal information. Email addresses, phone numbers and such will be removed.
  • Add to the discussion. Comments that do not — typically off-topic or content-free comments — will be removed.

All comments containing links will be moderated before publication. Anything that looks the least bit like spam will be removed.

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