Friday, May 1, 2015

How do I make Windows 7 less aggressive in caching memory?



I've noted recently that Windows 7 on my machine has been complaining about running out of memory and that I should close some programs. It would then usually point out a program I have running that does have a memory leak and has grown quite large. However, usually these programs start at 20MB of RAM usage and only after running the program between 12 to 24 hours do they grow to, at most, 200MB of RAM usage. I never have more than three of these programs running at the same time, so 600MB of RAM usage max I have ever seen from my running programs.



I am running Windows 7 x64 on a machine with 4GB of RAM. At first I actually forgot this and would just restart the programs when Windows complained, but now that I remembered, the fact that Windows is complaining about me using 600MB of RAM (under 2GB even if you include memory used by the OS itself) seemed odd. So I pulled up the system process window to look at my total memory usage from my processes and system processes that were listed. It added up to just over 700MB, so I was still confused. Then I went to the Resource Monitor and opened the Memory tab. There I think I found my answer. It noted that I was actually only using 33% of my RAM. However, on the Physical Memory resource allocation bar, the Modified section was up to 2.3GB, the Standby section was up to 540MB, the Free section was under 20MB, Cached memory was listed at 2.8GB and Available memory was listed at 550MB. (These values being slightly rounded, of course, as thy are constantly changing as I write this.)



So apparently Windows 7 is using more memory than I am. I did, at some point in the past, make some modifications to the installed Windows services menu but that was only to disable certain hosting services, since I didn't want to do any media sharing, to enable the Telnet client, and remove Internet Explorer, but it could be my fault. Is there any way to make Windows not do this or at least cache a lot less aggressively so I stop getting these "Low on Memory" notices?



Answer



The Standby memory is not a problem, it is considered "free" and will be reallocated on request - it just contains memory recently used by programs, but is now freed. If another program requests more memory than is "Free" the system should allocate from the Standby set seamlessly (since "standby" memory isn't really in use at the moment).



Your excessive Modified memory is your problem, because it cannot be reallocated easily. See here. It's likely to be caused by either a memory leak (which seems to correspond with your first paragraph - what programs are leaking?) or a page-file being too small (is your page file fixed size or deactivated?).


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...