tags:

views:

177

answers:

4

I have a pretty beefy development machine and three monitors, so after some intense coding/problem-fixing I tend to have a boatload of programs up and running. Some of these programs are tabbed; things like Visual Studio, FireFox, Notepad++ and the like. If I'm no diligent in keeping unused tabs closed, it seems like after awhile Windows just refuses to open more, err, windows. I can open another by closing an existing one, but unless I do that, it just refuses to open any up.

Anyone seen this? I figure it's a hard limit somewhere as to how many Windows can address at the same time.

A: 

There is no maximum amount of open programs, if you don't open sizeof(Int32) on a 32Bit system, then the system will probably fail and die as memory is lacking.

So, you are probably looking a virus problem. And fyi, not programming related.

If this IS programming related, find the maximum amount of Notepads like this:

C#

int i = 0;

while (true)
{
  try {
     Process.start("Notepad.exe");
     i+=1;
  }
  catch(Exception ex) { break; }
}
Filip Ekberg
What virus do you know that just sits there silently and limits the number of threads/processes on a machine?
Geoffrey Chetwood
@Rick B, The virus you are trying to adress is called Windows </troll>. Seriously, if i knew, i'd fix it.
Filip Ekberg
@Filip: Seriously, this answer makes absolutely no sense.
Geoffrey Chetwood
+1  A: 

Windows may be given a truckload of memory but that doesn't change the amount of system resources available (such as handles, timers, etc). That is what causes most of the problems you are seeing.

Otávio Décio
Thats what i said with less fancy words..
Filip Ekberg
+1 for handle starvation. And you didn't say the same as this Filip, you inexplicably said it was a virus...
Stu Mackellar
I just wanted to point out that memory available does not equate to resources available.
Otávio Décio
A: 

Though not programming related this is something we as programmers can run in to as i've answered this elsewhere too

I know for a fact that in programs like mIRC there are a small but not tiny percentage of users who run in to the problem described here in this microsoft KB item which causes windows to fail opening untill another one is freed.

Martijn Laarman
+3  A: 

Yes, the hard limit is about 32,700 window handles on the whole system, if I recall correctly, or 10,000 per process. It should be noted that not only windows consume a window handle, but each and every control (every button, panel, combobox etc.) on every window consumes a window handle.

I've seen single dialogs (though way too heavy weight) consuming over 2000 window handles, but usually they use much less.

You can get an idea of the amount of window handles consumed by a process by enabling the column "USER Objects" in the task manager, this includes window handles.

For background information, see also:

Tobi