4

I have an ultrabook hybrid with a SSD (mSata) and HDD working with intel rapid storage and my PC has 6 GB of ram. So I want to know if I can disable virtual memory and what other things should I do to improve the performance of my system?

I´m using Windows 8 with a core i3 u3217.

50-3
  • 3,939
  • 4
  • 21
  • 28
Diego Macario
  • 153
  • 1
  • 1
  • 7
  • You can't disable virtual memory on any modern PC operating system. – David Schwartz Jul 20 '14 at 12:39
  • @DavidSchwartz, What do you mean by that? I'm currently running a [Windows with "virtual memory" disabled](http://i.stack.imgur.com/rmk1B.png) . Exactly 0 bytes of memory on hard disk. – Pacerier Jan 12 '15 at 11:58
  • 3
    @Pacerier You disabled your paging files, you didn't disable virtual memory. (See Jamie's answer below.) – David Schwartz Jan 12 '15 at 21:17

3 Answers3

7

It's not a good idea to disable virtual memory. The virtual management is a complex process but simplistically Windows only use the virtual memory if there is no "real" memory to allocate, then windows will swap the less used items in the memory to the virtual memory.

So if you have enough memory windows will not use the virtual memory, and will use it only if it need to be used. (This doesn't mean that it will not write anything in the virtual memory, but it won't cause a performance hit.)

But when you disable virtual memory and there is not enough memory for the apps, then you will get app crashes because of the not enough memory.

NoNameProvided
  • 2,370
  • 3
  • 16
  • 27
  • 2
    "virtual memory" in windows is used well before you run out of memory. – 50-3 Nov 17 '13 at 11:47
  • 1
    If I remember correctly windows constantly writes stuff to virtual memory just in case it later needs to free real memory. – Mattias Åslund Nov 17 '13 at 12:18
  • 3
    "windows only use the virtual memory if there is no 'real' memory to allocate". that's not true, windows puts all kinds of things into virtual memory automatically because they have a relatively low chance of being used or don't need to be fast if they are used. – Dave Cousineau Jun 17 '14 at 21:58
  • Exactly, I just make it simple to the questioner, because it will 'really' use it if there is no more memory to use (and if this happen then will the perfomance impact come). But this not change the key fact that disabling it is a bad idea. – NoNameProvided Jun 17 '14 at 22:16
  • This is just a much more complex question, e.g. if low priority memory com in, it will be preferentially paged out even if it has been recently used. There is a lot of to talk about this, I just want make it simple. – NoNameProvided Jun 17 '14 at 22:19
  • @NoNameProvided, 80% of your post is factually wrong. The remaining 20% doesn't answer the question. – Pacerier Jan 12 '15 at 07:56
  • @Pacerier Edit then and make it answer the question as the way you think. Btw as I mentioned before, its much more complex, but I think my answer is true on a simplified level. – NoNameProvided Jan 12 '15 at 09:29
  • @NoNameProvided, Look at Jamie's answer. – Pacerier Apr 12 '15 at 19:03
4

You can't disable virtual memory. Windows and your applications are always running in virtual memory. The addresses presented to the CPU by programs and by the OS are virtual addresses, not physical. Always.

Deleting the pagefile does not disable virtual memory. (The terminology in the Windows dialog is misleading.) What it does is disable paging to disk for a particular type of virtual memory called "private committed" memory. This will likely cause the other major type, mapped memory, to be paged more than otherwise. This will not improve performance.

Here's a more complete analysis: http://azius.com/blog/why-do-i-still-need-a-pagefile-or-how-can-i-be-out-of-memory/

Jamie Hanrahan
  • 23,140
  • 6
  • 63
  • 92
  • We expect more then just a link to another website. A website I might add that has incorrect information. – Ramhound Jul 20 '14 at 09:22
  • 1
    He's right though. Programs don't ever use anything but virtual memory. Allocated regions are automatically moved between swap and physical memory, if possible. – Daniel B Jul 20 '14 at 10:16
  • If @Ramhound will indicate exactly what "incorrect information" he has perceived, I will be happy to clarify. – Jamie Hanrahan Jul 22 '14 at 09:44
  • Of course you can disable virtual memory, at least in Windows 7. Here is an article which explains how: http://windows.microsoft.com/en-us/windows/change-virtual-memory-size#1TC=windows-7 – Druvision Jan 21 '15 at 18:03
  • 1
    It's using wrong terminology. That article tells you how to change the size of the pagefile - including setting its size to zero. But the pagefile is not synonymous with virtual memory (despite what that article and even the Windows dialog says), paging to and from disk will still occur after you disable it, and all the counters in the system that reflect sizes of virtual memory will look the same as always... except the commit limit, which will be much smaller. The _Windows Internals_ book has it right. – Jamie Hanrahan Jan 21 '15 at 18:33
  • @JamieHanrahan, Regarding the last sentence of your blog post, why do you say *"But there’s still no benefit to removing the pagefile"*? There is a benefit. And the benefit is that we can **guarantee** the private commited bytes wouldn't **ever** make it into the hard disk. Without removing the pagefile, you can never have this guarantee because the system is free to do as it wish. – Pacerier Apr 12 '15 at 19:07
  • Yes, removing the pagefile forces the OS to keep **all** of **one** type (private committed) of virtual memory in RAM at all times. But why is that a benefit? Paging (including writes to disk) is not reduced thereby! It simply happens more often to the other types of v.m. If you think that old stale private committed stuff should be kept in RAM at all times, even in favor of more-recently-referenced shared memory (which is more likely to be in hot code paths) have at it... but this is not justified by either theoretical analysis or performance measurements, for the vast majority of app mixes. – Jamie Hanrahan Apr 12 '15 at 20:15
  • @JamieHanrahan, What would be some solutions to force the OS to keep all mapped memory resident? – Pacerier Apr 15 '15 at 02:29
  • There is no way to do that. – Jamie Hanrahan Apr 15 '15 at 19:44
  • And I should add that you really don't want to. Allowing mapped memory to be paged out has many benefits. Why would you want to keep in RAM a whole bunch of stuff that you're not accessing ,just because you accessed it once? – Jamie Hanrahan Jul 14 '15 at 16:32
1

I am not a Windows expert, and I am telling this purely as a longtime user-of-Windows' perspective.

If you enable virtual memory:

  1. A large file (usually 1.5 times of physical memory size) is created at the root directory of the system (usually, c) drive. This file cannot be moved to another drive. If your system drive is a small SSD, and say you have a 16GB memory, this will really bother you.
  2. If you minimise a program and restore it after a long time (like several hours later), Windows will read the drive a lot, and the program becomes unresponsive for a while. Possibly, Windows had put all the memory of the program into the virtual memory and tries to restore the memory when activated.
  3. Real memory saved from 1 and 2 above may be utilised for file caching. File that was once read can be read super fast from the next time. Notice that, Windows does this whether virtual memory is used or not. It is just there would be more real RAM for this, if virtual memory is enabled. You may or may not notice the effect anyway.

If you disable virtual memory:

  1. You will not experience the first two annoyances in the "enable" section.
  2. If your RAM usage nears the size of the physical memory, yes "nears" not equals, Windows will constantly show a pop up message saying the system is running out of memory. For example, if you have 1GB of physical RAM and the Task Manager shows about 0.5GB of RAM is used, but Windows may keep showing the warning pop up.
  3. If your RAM usage really really nears the physical memory size, the entire system may become really really slow and unresponsive. Applications may crash without apparent reasons.

Other than that, I have not experienced any downside of disabling virtual memory. I think virtual memory technology was invented long time ago when PCs have 8MB or 16MB of RAM (MB not GB). When I was a college student I took an Operating Systems class, and learnt how virtual memory worked. It was a general mechanism, not Windows-specific, though. It may have been useful when PCs had really small amount of RAM, but now anyone can easily afford 16GB on one's desktop. I think virtual memory is not so useful anymore, unless you are using a laptop which has unexpandable 4GB RAM. I personally have disabled it on my PC which has 16GB of RAM.

In your case, if you are 100% sure that your RAM usage will never exceed 5GB (since you have 6GB), go ahead and disable it.

Damn Vegetables
  • 3,622
  • 16
  • 46
  • 78
  • 1
    That's not true, the swap file can be moved to another drive. – Daniel B Jul 20 '14 at 10:12
  • Here is how to disable virtual memory completely, at least in Windows 7: http://windows.microsoft.com/en-us/windows/change-virtual-memory-size#1TC=windows-7 – Druvision Jan 21 '15 at 18:03
  • As described above - no. You can't "disable virtual memory completely". You can disable the paging file, but that is one out of many, many files involved in paging to and from disk. Paging will still occur, and paging to and from disk will still occur; the performance counters will prove this. – Jamie Hanrahan Apr 15 '15 at 19:46
  • @Sin Jeong-hun Your advice to disable the pagefile is hugely misguided. Only someone with a very limited knowledge of what virtual memory is, how it is used, and what its benefits are, would conclude "virtual memory is not so useful any more". There are many, many benefits of virtual memory. The fact that a modern system may show much of its RAM "free" or "available" does NOT mean that it could live without v.m. In fact, virtual memory allows RAM to be used far more efficiently, so the same workload would probably not run nearly as well without it.... Not that you can turn it off anyway. – Jamie Hanrahan Jul 17 '15 at 00:02