No, programs don’t typically expand to fill all available memory. They use however much they need, almost regardless of how much you actually have, and therein lies the source of most memory-related slowdowns.
There are lots of reasons one might want multiple gigabytes of memory, but it shouldn’t really be for something as simple as FireFox. I’d have to agree that someone’s a memory hog in that situation, but it might not be FireFox itself.
Your situation – everything just working with relatively low memory usage – is actually much more common.
Become a Patron of Ask Leo! and go ad-free!
Background: how good programs use memory
A well-written program doesn’t actually pay attention to available memory. Instead, it simply uses only the memory it needs, and no more. It also releases memory for use by other programs when it’s no longer needed. That’s an oversimplified definition of program that’s a good citizen.
If a good citizen program uses a lot of memory, there’s a reason, and in most cases, the reason is performance. Games are a good example – if written properly, a game can keep information in memory for significantly faster access than if it had to read that information from disk.
Other programs can often also take advantage of additional memory in the same way. Database programs are a good example. Programs like Quicken could fall into the same category. If you’re working with a large database of Quicken data, it’s conceivable that it could use a lot of memory. A good, but inexact indicator might be the size of the Quicken files themselves.
Background: how Windows handles memory
One of the features of most operating systems today is that they allow programs to request and “use” more RAM than is actually available memory on the system. By that, I mean that a program can request from Windows, say, 4 gigabytes of memory, and Windows could grant that request, even on a system that has less than 4GB available memory, or even less than 4GB of memory total.
Obviously, the program doesn’t really have direct access to RAM that doesn’t exist. Instead, Windows notices when a program tries to use some of that non-existent memory. When that happens, Windows shuffles things around, moving some of what’s in RAM to disk and reading back from disk some of what used to be in RAM. This whole (very complicated) process is what’s called virtual memory – using space on the hard disk to make it look like there is more available memory than there actually is. (Again, the disk space is not actually RAM, and is very separate from RAM – it’s just being used in a way that allows Windows to make it appear that there is more RAM.)
The problem with virtual memory is that disks are slow. No matter what type of disk you have – even solid state – actual RAM is always going to be faster. The net result is that if your computer finds itself running out of actual RAM because programs are requesting more RAM than actually exists, the system will get slower as Windows reads and writes virtual memory to and from the disk.
Reason 1: A program accidentally using all available memory
The most common case of an application using too much memory is what’s called a “memory leak”.
Recall that I said a good citizen program “frees memory for use by other programs when it’s no longer needed”. A memory leak is a fairly simple situation where a program loses track of the memory it has used, and neglects to free it for use by others. In other words, it’s a bug or mistake in the program.
In the cases you’ve heard about, I’m not pointing the finger at FireFox. While it could have a bug, as far as I know, it’s been very well behaved of late. More likely is that one of the add-ons installed has a problem, or even worse, malware of some sort is present. Unfortunately, browser add-ons are a common source of bugs and memory issues, as is malware.
While not totally benign, memory leaks are mitigated by the way Windows manages memory. If a program isn’t actually using all the memory it has requested, Windows might swap the contents of unused RAM into virtual memory in the paging file on disk, and free it for use by other applications. That actually just delays the eventual problem of the paging file filling up.
Virtual memory is given a maximum size to prevent the paging file, where virtual memory is written to disk, from consuming your entire hard drive in the case of a memory leak. No matter how large the paging file, however, if there’s a serious enough memory leak then not only will your computer run out of RAM and spill over into virtual memory, but eventually it’ll consume all of virtual memory. When that happens available memory is truly exhausted and many programs will misbehave, run exceptionally slowly, or even simply crash.
Even before the programs use up all of virtual memory, however, a memory leak or other high memory use scenario could absolutely result in your system running more slowly.
Reason 2: You might cause all available memory to be used
Programs themselves aren’t the only culprits when it comes to using too much RAM.
It could be you.
The number one reason that well-behaved software can end up using all available memory is pretty simple. Either:
- you’re trying to run too many programs at once
- you’re trying to do too much with the program(s) you are running
The first one is pretty self-explanatory: if you run several programs simultaneously, then they all will need some RAM. The accumulation of all programs requesting RAM could be more than you have installed, and thus could result in virtual memory being used and hence slowing down your system. The solution is also pretty simple: when you’re done with a program, make sure to exit it. When a program exits, all the memory that it had in use will be released for other programs to use.
The second one is a little less obvious. I’ll use a browser like FireFox as an example.
How many tabs do you keep open as you use your browser? As I type this my browser has 7 tabs open, each to a different web page. In fact, I also have a second browser window open (an incognito or in-private browsing session), with another tab open there as well. Each tab causes the browser to use more memory. If you open enough tabs, then your computer will eventually run out of RAM and start using virtual memory.
And to be clear, it’s not just browsers that operate this way. Almost any significant program will vary its need for RAM based on what you do: multiple documents in a word processing program; multiple photos in a photo editor; even the size of the files that you’re working with can impact a program’s desire for RAM to do what you ask of it.
Reason 3: Your installed programs might cause all available memory to be used
As we’ve seen, running too many programs can quickly cause all of your computer’s RAM to be used.
There’s a good chance you’re already running more programs than you think you are.
Many programs – many, many programs – install “auto-start” items these days. These are theoretically small programs that are set up to run automatically when you boot your computer or when you log in. If there are many of these, each with its own desire for some amount of RAM, they could be impacting the amount of RAM that’s “left over” for the programs you’re choosing to run yourself.
Now, auto-start programs aren’t inherently bad. Much of Windows itself is, in essence, an auto-start program, and many of its features are implemented as programs and services that start automatically. That’s as it should be.
Many programs you choose to install require some auto-start component – and thus some amount of ongoing RAM usage. Programs like your anti-malware tools, your software firewall, WinPatrol, DropBox, Evernote and others all provide important functionality that relies on some program running at all times.
However, some programs install what many feel are unnecessary components that auto-start. Those simply use resources, like RAM, for no real benefit. Unfortunately there’s no list I can give you of what’s safe to remove here, since it depends both on the programs you use, and how you use them. What’s a waste of resources for one person might well be a valuable feature for someone else.
Bottom line: more RAM is almost always better
So why would you want more memory than the programs you use require?
There are a couple of reasons.
Windows can use the memory for better handling of its own operations, such as reading and writing files to disk. In fact, adding memory to a slow system is one of the best ways to improve Windows’ performance.
Windows is a multi-tasking operating system, and as we’ve seen you can run more than one program at a time. I do this a lot. As I write this I have several programs running including my browser (with several tabs open), a text editor, a music player, a virtual machine running another copy of Windows, and a few other things. The more memory, the less impact all these running programs have on each other’s performance.
13 comments on “Three Reasons Programs Use All Available Memory in Your Computer”
On the subject of memory leaks and internet browsers, there’s one thing I’ve run into over and over that causes poor performance:
Flash-based browser games.
Many are poorly written, consuming RAM in excess of that consumed by a commercial 3D action game played on the same computer.
So, if your browser is using way too much RAM, consider exactly WHAT you have open as well as how many tabs, etc.
I have only had memory issues since upgrading from Win8 to 8.1
My machine has 12Gb of RAM but when it is left idle with only background processes running I will get a low memory warning telling me to close apps. When I check in Task Manager it shows only about 12% of memory usage. I simply close the low memory warning window and have never noticed any ill effects. Oddly it only happens when the machine has been idle for a while and not when I am using it. I never had this issue when this same machine, with the same set up and apps, was running Win8.
Checking on the net indicates that others are having similar issues after upgrading to Win8.1
Is there anything that you think I should do to eradicate the problem or should I just ignore it as it doesn’t seem to cause any issues ?
Leo, I have to disagree with your statement:
“A well-written program doesn’t actually pay attention to available memory.”
A well-written program will use only as much memory as it needs. A very-well-written program will adapt itself to the environment (either completely automatically, or within configured limits/guidance) and use more resources if available to improve performance. One example from programs I use is something like PTgui (panorama photo-stitching software) — when rendering the software has to use many many temporary files (many gigabytes, even terabytes) and it can do either disk-based or RAM-based temp files. And no, it’s not the same thing as using disk as a swap file. Performance would be horrendous for the software to only use <1GB of RAM and thrash my disk, but it is aware of how much RAM my system has (64GB) and takes full advantage of the available memory.
the problem i am seeing with browser tab is when you have several tabs open then close the extra tabs the processes con tinue still using ram at this moment i have opera open and had 7 tabs i closed all but one but task manager shows all 7 still open
What about the case of WmiPrvSE which is hogging about half of my 4GB Win7 64-bit available memory? I can’t find any help articles that tell why or how this &$%*(* thing works or does its dirty deeds. This, I am told, is a Microsoft program, and it’s necessary to keep it running. What??? Who makes the rules about good computing and then breaks them: Microsoft.
Leo, is this true (and/or safe)?
I’m told to open MSCONFIG, disable the entire START-UP tab list (not SERVICES), then re-boot. Supposedly the computer then by default will load only the basics needed to start, thus ignoring self-starting superfluous RAM hogs. Yea or nay?
Yea and nay. You probably can disable some startup items, but there are others you might need. See this article for more information on the subject:
Nay. It’s not that simple at all. There are probably things in MSConfig start up that you actually want. Fortunately this technique will not render your computer unbootable (playing with services can), but as I said – you’ll probably lose something you want.
Leo: you missed one thing – *How* to tell your users to show much memory is being used! There is, of course, the tried and true Task Manager (right-click on taskbar, select Task Manager) in which the Processes tab will show how RAM much each program is taking. Although the Task Manager has been much improved in Windows 8, I prefer the “Resource Monitor” which not only shows current RAM usage, but also CPU, Network and Disk. An article on how to best use the Resource Monitor may be in order.
You mean like this one? http://askleo.com/monitoring-your-system-with-resource-monitor/ :-)
Just wanted to point out the comically obvious. The picture shows 30-pin SIMM chips. In 2015, THAT may be your memory issue. ;-P
Seriously though, thanks for what you do, Leo. Your wisdom and your ability to communicate it to the masses are a great asset to the interwebs. Thanks for sharing it and keep up the good work!
Reading your article I stumbled on this statement “In the cases you’ve heard about, I’m not pointing the finger at FireFox. While it could have a bug, as far as I know, it’s been very well behaved of late.” Lately FF crashes on me 2-3 times a day. It’s getting really annoying. I’ve been using FF for a long time, gave it up once because it crashed because of flash, went to chrome and it started crashing and came back to FF (after using FF again I bought a new Dell PC). I’ve tried using with all add-ons disabled and still it crashed. I guess it is because I only have 4gb RAM. Everything else works fine. It’s frustrating so I’m venting. Thanks for your article.
4 GB RAM should be enough as long as you don’t have a lot running. I’d try disabling the add-ins one by one, as add-ins are usually the first suspect when a browser crashes.