Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have 4 GB of RAM, but Windows still thrashes disk sometimes (especially often when an application is minimized for some time and then I activate it again). Completely stupid, because Task Manager shows 2 GB of RAM are free. Is there any way to prevent Windows swapping out program memory?

I tried setting Superfetch to cache startup files only (it helped a bit) and turning off paging file (it helped much, and worked well for me in Windows XP; but Windows Vista/Windows 7 don't allow that - it shows "low on memory" message frequently, even when I have 1 GB of RAM free.)

What can you advise me to do?

share|improve this question
6  
You don't want to turn superfetch off with 4GB of RAM, but you might want to turn Indexing off. Leave the page file alone, Windows knows more about it than any of us. I can't help with the paging, though. –  Phoshi Aug 31 '09 at 12:03
2  
No, I certainly DO want to turn it off. Damned thing is too badly designed. Once I found it loading all files of some game at each boot (I used to play in the evenings), and that ate half of my RAM, and that was last day Superfetch was running on my PC with unrestricted settings. –  skevar7 Aug 31 '09 at 14:31
1  
The term thrashing generally refers to the situation where physical memory is full or nearly full, and constant page swaps occur. It does not refer to normal page swap activity. What you are seeing is not thrashing, but just how the memory management algorithm was designed. Keep space available for newly spawned processes, assume that a process that has its window minimized is not being used and should move its memory off to disk and the such. –  spowers Mar 14 '10 at 14:48
    
That's the worst decision ever to assume that because a window is minimized it is not being used. If it's minimized, it's because there's not enough room for it on the screen while multitasking. I'm so sick of returning to my computer and despite having few programs running, it will lag and stutter to bring data back from the page file when I'm restoring some windows from a minimized state, despite have GIGs of free RAM. The page file should NEVER be touched unless I'm running out of RAM. If Windows wants to make assumptions about minimized programs, do it when there's actually not enough RAM. –  Triynko May 28 '13 at 15:03

6 Answers 6

up vote 3 down vote accepted

The only way I've found was to increase RAM size to 8 GBs and turn off paging by setting

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Memory Management\DisablePagingExecutive=1

(reboot required).

That reduced disk activity to nearly zero.

share|improve this answer
    
I suspect you had a quirky or slow drive to want that. I have something similar and contrary to what most assume in here, what you did would be a good solution. Increasing the RAM and using minimal or no disk paging might be a more intelligent (and economic) solution than replacing slow media. –  leladax Feb 2 '13 at 17:48

Check out Control Panel\System and Security\System > Advanced System Settings > [Advanced] > Performance: Settings > [Advanced]

Processor scheduling is related to your issue, as is the ability to disable the paging file which you shouldn't be doing. (You need it)

share|improve this answer

Just leave the virtual memory management to Windows, it does a good job. Paging (and thus Mark Russinovic's blurbs regarding the matter) are rather irrelevant to disk thrashing (if you have system memory in abundance), you are looking for NTFS tweaks.

O'Reilly has an interesting article about NTFS Performance Hacks.

On the hardware side: a better hard drive with higher spin rate and larger cache will help a great deal too.

And here is how to kill the low memory warning, take ownership and nuke the following registry keys.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WDI\DiagnosticModules\ {5EE64AFB-398D-4edb-AF71-3B830219ABF7}]

and

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WDI\DiagnosticModules\ {45DE1EA9-10BC-4f96-9B21-4B6B83DBF476}]

This will prevent the Diagnostics Service from loading RADAR. It works for me in Windows Vista, the keys are present in Windows 7. I haven't tried it though - just backup those keys before you delete them.

share|improve this answer

Move to the Linux, it doesn't do that.

People would be telling you that Windows is smarter than you and you shouldn't fiddle with page file settings and they are right. But that system is mostly tuned to allocate new memory for a process almost instantly and it does that good. One of the side effect is that it moves everything you have in memory into disk all the time, so when it needs new portion of memory it could just erase this portion of memory and give it right away if it hasn't changed of course. I believe that when you leave you applications running, all of they data got stored into disk and then at some point other applications or caching system start using this memory. So application is left with bare minimum of their data into physical RAM and when you start using it again it has to get everything back from the disk.

That said, I don't think you can do everything with that, it just one of the main properties of the system. You can make it only worse by turning the page off or doing any other system tuning. You can't make it work as you like as it just wasn't written with that in mind.

share|improve this answer
2  
And once again a "my windows does that, how can I...? -> Move to linux" answer. However the rest of the answer is correct, but you could have done without the first sentence. –  Gnoupi Aug 31 '09 at 14:16
    
@Gnoupi, I can't help with the fact that it is the only solution to OP problem :) –  vava Aug 31 '09 at 14:51
2  
Not true. If he never turns on his computer anymore, no more disk trashing. That's another solution. –  Gnoupi Aug 31 '09 at 15:28
    
Oh well, Linux solution is still less radical –  vava Aug 31 '09 at 15:50
1  
@Gnoupi, would it be better if I start with "Buy a Mac"? :) –  vava Aug 31 '09 at 15:52

Mark Russianovich has written a good long article on Virtual Memory,
Pushing the Limits of Windows: Virtual Memory

Virtual memory separates a program’s view of memory from the system’s physical memory, so an operating system decides when and if to store the program’s code and data in physical memory and when to store it in a file. The major advantage of virtual memory is that it allows more processes to execute concurrently than might otherwise fit in physical memory.

While virtual memory has limits that are related to physical memory limits, virtual memory has limits that derive from different sources and that are different depending on the consumer. For example, there are virtual memory limits that apply to individual processes that run applications, the operating system, and for the system as a whole. It's important to remember as you read this that virtual memory, as the name implies, has no direct connection with physical memory. Windows assigning the file cache a certain amount of virtual memory does not dictate how much file data it actually caches in physical memory; it can be any amount from none to more than the amount that's addressable via virtual memory.

It is a very good read.

How Big Should I Make the Paging File?
Perhaps one of the most commonly asked questions related to virtual memory is, how big should I make the paging file? There’s no end of ridiculous advice out on the web and in the newsstand magazines that cover Windows, and even Microsoft has published misleading recommendations. Almost all the suggestions are based on multiplying RAM size by some factor, with common values being 1.2, 1.5 and 2. Now that you understand the role that the paging file plays in defining a system’s commit limit and how processes contribute to the commit charge, you’re well positioned to see how useless such formulas truly are.


Earlier article: Pushing the Limits of Windows: Physical Memory

You can see physical memory layout with the Meminfo tool by Alex Ionescu.

share|improve this answer
2  
Nothing new to me there. And that's not an answer to my question at all. –  skevar7 Aug 31 '09 at 12:18
2  
@skevar7 : Not an answer for you maybe, but good links to explanations about the whole thing for somebody who would find this topic and who wouldn't have as much knowledge as you. –  Gnoupi Aug 31 '09 at 12:59
1  
rule of thumb: don't even mention Paging unless it is with absolute certainty related to your problem or if you just want to spark an endless discussion about the DOs and DON'Ts ... same goes for web browsers and anti virus software :) –  Molly7244 Aug 31 '09 at 13:30
1  
I'm absolutely sure paging is guilty, coz perfmon shows hard faults when disk is thrashing. I certainly DO know that turning off paging file significantly improves performance. It's an objective fact and it can be measured. The only problem is that Windows since Vista doesn't want to work in such configuration anymore. –  skevar7 Aug 31 '09 at 13:52
2  
@skevar7 : And maybe, just maybe, there are competent people thinking at Microsoft, and they thought and decided that the page file was needed. They haven't done it just to bother you. –  Gnoupi Aug 31 '09 at 13:57

It sounds like you installed a cache/mem cleaner. They move applications to swap when you minimize them rather than leaving them in memory.

Is the system slow or are you just using the word thrash because you see the HD light flashing?

share|improve this answer
    
No cleaners. Sometimes it takes much more time than usually to perform simple operation (5-10 secs) and disk is thrashing. This usually happens after app being idle for some time. Very simple omperations - open new tab in Opera, create new file in Visual Studio, etc. So I suppose Windows paging algorithm is far from perfect. Completely turning off paging file worked well for me in WinXP, but unfortunately Vista and Win7 don't allow that. –  skevar7 Aug 31 '09 at 12:50
    
Unlike many OS's Windows will put up with a fair amount of hardware issues without crashing and it could be that some sort of recovery is going on in the background which is causing the lag. I know it sucks, but run an HD test to make sure it isn’t jacked up as it really sounds like an I/O issue since the problem goes away when you don’t allow the system to use swap. Check for BIOS updates related to I/O, hd controller, etc. as there could be a known issue. Does the system take FOREVER to boot (XP, Vista, or 7)? If so, it’s definitely an I/O problem. –  UnderLoK Aug 31 '09 at 15:22
    
*I should have said "Windows will put up with a fair amount of hardware issues without notifying you of a problem" ;) –  UnderLoK Aug 31 '09 at 15:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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