12

Is there a modifiable equivalent of "swappiness" in Windows 7?

My system has 8GB of RAM which is more than enough for my day-to-day use. I'd like to modify swap behaviour, what *NIX systems call swappiness and set it to 0, as I've done on my Ubuntu machine.

I've searched the Web for this but all answers seem to be for *NIX systems.

4
  • Out of curiousity, is setting the swappiness to a higher or a lower value better? – Jon Sep 12 '13 at 2:03
  • It depends on how much RAM you have and how much of it you're using. In my case, setting it to 0 will only swap to the disk to prevent an out of memory error. See this answer on AskUbuntu for more @chipperyman573 – rath Sep 12 '13 at 2:06
  • 1
    it seems like windows doesn't have an emergency protection against out of memory errors. See the link from my answer. – wullxz Sep 12 '13 at 2:10
  • possible duplicate of How to control RAM / swap usage – Ƭᴇcʜιᴇ007 Apr 27 '14 at 4:58
7

Under Windows there's something called "pagefile" where the system swaps applications to get the RAM free. I'm currently not at a Windows machine but the steps that Adobe put online here look right (I think Win + Pause is a shortcut to "Advanced System Settings).

Although it is possible to disable the pagefile, there are some concerns about that. For more information read this

6
  • 2
    As you say in your comment, Windows indeed seems to have no protection against out-of-memory errors. This leads me to believe there is no "swappiness" equivalent. +1 nevertheless for the interesting new shortcut I've learned, and marked as accepted because the link you posted led me to this article. Cheers – rath Sep 12 '13 at 2:19
  • There are many people out there with the page file turned off. The system does toss a few things in there that it will not be using for some time in a way that could be concidered unnessiary. The system isnt likely to "run out of memory" except in situations where the user usually knows what is going on, there is often masses of cache that can be freed up first (assuming it was freed proper). The Reason for not disabling it completly Some Programs will have a Fit, if it is not there. And the errors they toss will not make sence always. – Psycogeek Sep 12 '13 at 5:16
  • 1
    I have a laptop with 8GB of RAM and have been using with swap off. There is no difference between having 8GB of RAM with no swap vs 4 GB of RAM + 4GB of max swap. There is always a limit, and once you reach that you will see errors. – Natan Nov 13 '13 at 8:46
  • @Natan: I'd take the 8GB of RAM over 4+4 any day, what happens to your performance when you run out of physical during RAM-intensive operations? – Mark K Cowan Sep 2 '14 at 8:42
  • @MarkKCowan I guess there is a difference between having 128MB and 8GB of RAM. When memory is getting full, the OS will start reclaiming memory and garbage collectors will do their jobs. In a desktop with 8GB, it is practically guaranteed enough of it will be reclaimed to keep going, because most of it is cache. If you run out of memory, swapping will always be worse than reclaiming memory because the disk is orders of magnitude slower than CPU + RAM. – Natan Sep 2 '14 at 11:58
1

There's more to virtual memory than just "apps allocating RAM and when physical RAM runs out, something gets paged out to SWAP".

In Linux (and possibly UNIX at large), the system tries to keep pages recently read in RAM: programs executed, data loaded, data recently written (already on disk too) etc. So that if the same program gets executed again, it doesn't have to get re-loaded from the disk. When some program asks for more memory to be allocated to its virtual address space, first the left-over disk buffers are re-purposed (without disk access). If this is not enough, some pages of running apps, that have not been accessed recently, get actually swapped out. On Linux, swapping normally doesn't happen at all. Once your system starts swapping, you notice the increased drive activity (and sluggishness) and you go "oh what the f.." because it probably means that some app is leaking memory, or something under the hood has started spawning out of control.

Windows traditionally have a stupid additional habit, that they swap out whole user-space apps after some timeout on their inactivity. Strictly, without a pardon, just to have as much RAM available as possible, "just in case" you wanted to start yet another hungry app. If you leave your PC running, and you go away for a few hours, upon your return you notice that any app you switch into, it gets sloooowly reloaded from the swap. This behavior was particularly painful in Windows 2000 and is getting gradually less noticeable in more modern Windows versions. In W2k, turning off the swap was a no-brainer. Windows 7 can still ooze like honey sometimes for no particular reason, Windows 8.1 and 10 got noticeably better... but still there's no tweakable knob for "swappiness", or other tuneable parameters of the swapping algorithm.

There are other factors that can lead to the system grinding along slow disk access. In Windows 7, you never know if the system has just swapped out your app in the good old W2k fashion, or if you should blame the Antivirus for the fact that your app is starting so slow, or if it's Windows Update doing something in the background this time around (known to have reciprocating quirks in its algorithms that lead to hangs with 100% CPU consumption and/or disk thrashing), or if specifically some .NET Framework janitoring task got lost in the WinSXS database or what. On occasions / in some Microsoft software versions/incarnations, it actually seems that some windows-native "in the background tasks" (specifically Windows Update local database management) are deliberately "obscured" in the task manager, their CPU and RAM usage does not show in the total memory consumption. "Legitimate" activity, but pretty difficult to distinguish from a malware rootkit... Only once the thrashing stops and a balloon saying "new updates are available" instantly pops up, you know what the reason was.

Well at least the recent Windows versions can tell you disk IO activity per process, and individual services are now reported separately (instead of a single SVCHOST.EXE process).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.