Technology in terms you understand. Sign up for the Confident Computing newsletter for weekly solutions to make your life easier. Click here and get The Ask Leo! Guide to Staying Safe on the Internet — FREE Edition as my thank you for subscribing!

Why is Windows using more memory over time?

Question: I’m currently using Windows 7 Pro, but my question applies to all versions of Windows. I have 4 GB of RAM on my office laptop and after a clean reboot with my basic always-on apps running (Outlook, Communicator, anti-virus, etc.). I have 2 GB free. After running normal apps (Word, Excel, Sequel Server Management Studio, etc.) throughout the workday and closing them, I will only have 1.5 GB of RAM free at the end of the day. Then, less each day after, forcing me to reboot every couple of days if I don’t want to be strapped for memory. This has been happening ever since I can remember. Now I can understand poorly managed apps not freeing up memory after use, but this will happen after using nothing other than Microsoft apps which one would think would have memory management under control? What gives? Any insight would be appreciated.

Memory management in any operating system is unimaginably complex. It’s either the stuff of nightmares or pure magic, depending on who’s talking about it.

From what you describe here, I actually don’t see a problem. That may sound weird, but I’ll talk through why I feel that way.

Become a Patron of Ask Leo! and go ad-free!

Shrinking memory?

You mentioned that you are being forced to reboot. How? Are things actually failing? If so, then you have a problem.

If not, are you only rebooting because you see your memory getting smaller?

If you didn’t reboot, I bet that nothing would break. Everything would work exactly as it’s supposed to and it would continue to work appropriately.

You see, understanding how much memory is free in Windows is one of those things where you simply can’t get a straight answer. Not from Windows, the tools, or even the people that understand how it works. That’s because Windows memory management is so incredibly complex.

Memory UsageHow Windows uses memory

Windows can appear to use more memory over time.  But I’ll call it a kind of an opportunistic use of memory: memory that Windows uses, but doesn’t actually, absolutely, need. If Windows turns out to need memory for something else later, it can free something up.

For example, let’s say you run Notepad1. When you run this program, memory is used for both the program and its data. When you close the program, you’d expect that all that memory would be freed.

In reality, Windows actually tries to be a little bit smart, just in case you soon run Notepad again. Even though you’re done, while it frees the data that had been used by Notepad, it leaves the actual Notepad program in memory.

That memory appears to be in use because Notepad is still in its memory. From your perspective, it’s not really being used because you’re not running Notepad. Yet.

If you do run Notepad again since the program is already in memory all that Windows has to do is allocate space for the data that Notepad might use. It doesn’t actually have to read the program from disk, so Notepad appears to “load” more quickly.

Now, let’s say you don’t run Notepad again, but Windows left it in memory just in case you did. If you then run some other program and Windows determines that it’s running out of memory, it will remove the Notepad from memory since it knows no one is using it to make room. Later, if you do run Notepad, Windows can read from disk. That gives you the extra memory that this other program wants to use.

Complex, but functional

This is a really simple, and in fact over-simplified, example. Windows works exceptionally hard on these kinds of opportunistic memory-use scenarios for more than just program loading. Memory allocation, file reads and writes, even Windows own background processes are all trying to make use of memory as efficiently as possible. And in this case “efficiently” means finding that balance between performing tasks quickly, perhaps by using more RAM, and making room for other programs as needed by freeing up some of that RAM.

Not only is it the stuff of nightmares, but it is amazingly well done. The speed that you see in Windows today is actually pretty darned incredible given its incredible complexity.

Unless there’s something behind this comment that you made about being forced to reboot, I wouldn’t worry about anything. I would not try to interpret what free memory means. It’s really too complex a concept to be useful for those kinds of decisions.

I wouldn’t worry about things unless there’s a specific problem.

Do this

Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.

I'll see you there!

Footnotes & references

1: Notepad is such a tiny program that it makes this example somewhat silly. If you like, consider instead some very large program, like Photoshop or Microsoft Word. The concepts all still apply, and the memory involved is much greater.

13 comments on “Why is Windows using more memory over time?”

  1. “restore points” accumulate! I gain many gigs of space by deleting all but the most resent, assuming all is knowingly well. CCleaner works good for this.

    Reply
  2. There’s another problem. Some programs have lousy memory management and as time goes by use – bit by bit – more and more memory. The programs claim memory and forget to release that memory when not in use (anymore). Such programs are e.g. Internet Explorer, especially when one plays a video. Then it can occupy A LOT OF memory and it won’t give that memory back. It also happens to programs that are used by Windows itself, like “svchost.exe”. Win 7 runs multiple instances of this process and one such process can easily occupy over 100 to 120 MB.

    However, there’s a program, a memory manager, around that curtails memory usage of programs run by Windows without negatively affecting those same programs. That program is called CLEANMEM and can be found at {url removed}. Compared with other “memory managers” it uses a different, a more harddisk friendly method to curtail memory usage of processes. It uses one special Windows API to do the “dirty work”.
    On top of that it also is capable of collapsing the size of the file cache. After doing a full backup of one’s hard drive that file cache can occupy the entire RAM.

    CLEANMEM is able to reduce memory usage of e.g. “Svchost.exe” from ~ 120 down to say ~ 40 or 50 MB.

    Leo, Check the program out !!!! can you give feedback on whether you like it or not ?

    Reply
    • While I’m not at all familiar with this one, most memory-management addons simply interfere with Windows own memory manager, and often make things much WORSE, or make some things (like benchmarks) faster at the cost of making other operations (like normal usage) slower. I generally recommend avoiding them.

      Reply
      • I agree. A lot of “memory managers” are fiddling with the API called “SetProcessWorkingSetSize()”. The tactic there is to claim A LOT OF memory for one process. Windows then starts pushing A LOT OF data from the memory to the swapfile. After that the “Memory manager” releases the previously claimed memory. But this can result in a swapfile growing in size and that doesn’t happen with CLEANMEM (too much).

        This program is different !!! It uses an API (EmptyWorkingSet() ) build in Windows. It puts Windows to work to do the dirty work, to reclaim memory. It’s therefore 100% Windows compatible. Unless, of course, the program doesn’t follow Windows’ guidelines.

        But I’ve installed the program myself and I have NEVER experienced any negative impact of the program. Average memory usage on my Win 7 system with 4 GB went from ~ 55 % down to between 25% and 35% and sometimes down to 20% since I installed the program. Memory usage going down from 55% to 30% is a reduction of ~ 25% or ~ 1 GB !!! One program was so badly programmed that it used ~ 600 MB but CLEANMEM was able to cut that down to ~ 50 MB without any hiccup.

        That also means that the socalled “Standby Memory” can occupy more of the rest of the remaining memory and that in turn allows Windows to load more programs in that “Standby Memory” and makes switching between programs faster.

        The difference between SetWorkingSet() and EmptyWorkingSet() is that the first FORCES Windows whereas the second takes whatever a program/process is willing (!!!) to release. More over, if a program/process wants to, it can reclaim that released memory without a hiccup. Yes, memory management is incredible complicated.
        Weblinks:
        http://forum.piriform.com/index.php?showtopic=28918&st=20#entry185317
        http://forum.piriform.com/index.php?showtopic=28918&st=20#entry185325

        Are you still a computer geek or not ? Do yourself a favour. Read the explanation on the website “www.pcwintech.com”. The author gives – IMO – a good explanation of how the program works. Install the program and look at Task Manager how good the program works. At least, try it !!!! CLEANMEM was recommended as the best free memory optimizer.
        http://www.techsupportalert.com/best-free-memory-optimizer.htm

        Reply
        • OK, one last time on CleanMem – this is falling into the “anything that looks like spam will be deleted” category, and 4 comments in 24 hours pushing CleanMem HARD absolutely qualifies as looking like spam.

          Memory cleaners – including cleanmem – all make the fundamental assumption that they know better how to manage memory than Windows itself does. That’s an assumption that I’m unwilling to accept. Clearly this position makes supporters of this utility very upset. Nonetheless, it is my strong belief and position.

          Even the last link you include above includes this statement: “My recommendation, if you have Windows 7, is to leave well enough alone.”

          The best cure for memory problems is to either a) run less software or b) get more RAM (even the utility’s author says the later).

          If you run it and it works for you, that’s absolutely fantastic. Seriously, I really am glad you’re happy with it. You’ve made your case here. I disagree with it.

          Anyone wanting more information on cleanmem can follow the links above, or Google the utility and make up their own minds.

          Topic closed.

          Reply
  3. I reboot my machine at least once a day. I find it helps ‘clean out the RAM cobwebs’ and it seems somewhat faster.

    Reply
  4. I have a reasonably functional Broadband connection with lowish RAM on Windows XP. Microsoft Security Essentials appears to grab most of the available memory when updating (usually at start of connection to the Internet), often disabling the connection for several minutes-for updates. This is irritating to say the least. Is there a way of scheduling MSE updates or at least controlling memory usage by it during the process?

    Reply
  5. I have Windows 2008 server which builds up standby memory and does not free up for my website written in ASP (Classic ASP). It appears that Windows memory management is failing to understand the increase load of online users. Is there a way to move all the standby memory to “Free Memory” without rebooting the server?

    Reply
  6. I too am a strong believer in letting Windows manage memory as it wishes. And the less memory you have or the greater the workload the more important this becomes.

    Cleanmem creates available memory and this would seem a good thing. But the improvement is only cosmetic with no gains in performance. Microsoft could have included something like it in the OS if they wished. But they didn’t because the OS already has something better. Windows is fully capable of reducing the working set of a process if this is necessary or deemed desirable. And it in fact does this as a routine matter. But unlike the brutal approach of Cleanmem it can do this by as large or small amount as the situation warrants. And the memory manager has access to a great deal of data that allows it to make a more intelligent decision as to what process should be trimmed and by how much. Cleanmem has no access to this information.

    Incidentally, processes do not allocate or free RAM. They allocate from their own virtual address space. How much RAM as mapped to RAM is under the control of the memory manager. It is the memory manager that controls how much RAM a process is using. Processes themselves have limited influence over this and it is rarely used.

    In most situations Cleanmem will negatively impact performance, but usually not enough to notice. The only benefit is to make the numbers in Task Manager more attractive to people who do not really understand them.

    Reply
  7. I was forced to reboot a lot of times. When I run out of memory, running programs start to crash as I open new programs. I disabled pagefile btw to be able to use solely physical memory.

    Reply
  8. “You mentioned that you are being forced to reboot. How? Are things actually failing? If so, then you have a problem.”

    Yes, things are failing.
    I should admit it’s not a normal Windows performance. Only my machine in our office does it and I did not notice this problem till half a year ago.

    After Windows starts (no start up programs just antivirus avast!) less then 1Gb of RAM is allocated. After 1-2 hours of work with Notepad+Chrome/Firefox+OpenOffice Calc+Skype(optional) “Insufficient minimal virtual memory” error occurs followed by allocated RAM growth to 7+ Gb during next 1-2 hours. Once there Chrome/Firefox is first to crash (or Skype if it’s opened), then goes OpenOffice. Notepad seems to be the most stable/less memory dependent program.

    Some thoughts:
    Savings Wizard 1.0 Chrome extension is activated without any possibility to disactivate or uninstall it. Kaspersky online test did not show any malware present though.
    When allocated memory is 7+ Gb only about 1 Gb is shown in the current processes.

    Any suggestion would be highly appreciated.

    Reply

Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

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