Windows XP seemingly out of resources but plenty of free RAM and swap available

This one has been bothering me for years and so far I couldn't find an adequate solution.

The problem occurs on pretty much every XP install I've done. After opening a variety of programs or the system running existing programs for a while, Windows seemingly runs out of resources, without telling me.

There's ALWAYS free RAM. For example, it just happened to me and I had over a gig of free RAM. There are no viruses, spyware, or other nonsense - it is a Windows resource problem, but the question is which resource is it running out of, how does one pinpoint it, and how does one prevent it?

Sometimes, this happens after running specific programs - for example, today it happened when I started Photoshop CS4 and Flash CS4 at the same time. I also noticed that restarting The Bat (email client by Ritlabs) seems to get rid of this problem for a while but again, this happens on machines that don't even have The Bat installed.

So what does exactly happen? The symptoms are:

  • pressing alt-tab doesn't bring up the list anymore - it just jumps to the next window instantly, very similar to the way Alt-Esc works, however in this case, it's due to not having enough resources to bring up the alt-tab menu

  • random programs would randomly crash, citing random errors, out of memory errors, system resources, inabilities to do system calls, etc.

  • random programs would start missing random parts - for example, Firefox top menus might disappear, pull up partial selections, or not pull up anymore altogether. IE might lose a few of its toolbars. Some programs might fail to redraw or would just plain go gray where the UI used to be.

  • Windows itself never complains about running out of RAM, virtual memory, or anything at all, yet it's running out of something.

The only clue I was able to find and apply the fix today was this Desktop Heap Limitation. I haven't confirmed the fix working as not enough time passed. In the meantime, what are everyone's thoughts?


Solution 1:

Could be a handle leakage in a program you have running. I had a bug in one of my programs that exhibited these problems, bringing up new programs would have problems with missing or incomplete toolbars, file->open dialogs not showing, alt-tabbing not working properly, and strange errors, etc.

In Task Manager you can use the View->Columns menu to show columns for handle as well as user and gdi objects, which both uses handles, if you find a program with a high number there, it could be the culprit.

Unfortunately, what exactly a "high number" is depends entirely on the program.

In particular, pay attention to any program for which the handle count is steadily increasing, as this might indicate such a leak.

Solution 2:

That's because Windows has so called "desktop heap" where most of the GUI objects are living, menus, icons and what have you. And this space is pretty limited, and, what's more important, fixed in size.

See Q126962: On the desktop heap for solution and read Raymond Chen for some more information.