Pushing Operating System Limits

Raymond Chen notes that if you have to ask where the operating system limits are, you're probably doing something wrong:


This is a companion discussion topic for the original blog entry at: http://www.codinghorror.com/blog/2007/10/pushing-operating-system-limits.html

you know, I have been reading your plog for some time. You always seem to strike on a brilliant point!

However, I dont think I quite see what you are getting at with this post?

One other minor note… dose Opera not count as a web browser?

There’s a registry setting you can use to tweak and potentially solve this problem:

http://blogs.zdnet.com/Bott/?p=269

I never get that error anymore…

Actually, it’s probably more likely that the system runs low on memory and then it can’t use any memory to create new windows/menus/tabs.

I dont think I quite see what you are getting at with this post?

Test your application at moderate usage levels before releasing it. If your users are regularly running into hard-coded limits in the application (or the OS, for that matter), you failed them because you didn’t test appropriately.

I am positive there’s some poor bastard out there writing a front end to an industrial monitoring tool in VB that is getting close to that 65K control limit.

Sometimes the people stuck writing these front ends are trained engineers that picked up programming on the side, as a tool to fix an engineering problem. Due to this, their user interfaces would induce seizures on most people trained as interface designers, but to the engineer they make complete sense because they mimic the old fashioned control board they are trying to automate.

That does not make it right, of course. But the job gets done, the engineer is happy and moves on to something else. Until a couple of years down the road a “real” programmer gets hired to “update” the app.

This is a limit in the operating system itself, what you are running into is the depletion of space in the desktop heap, where the OS keeps a pointer to the location of every single UI element that has been created in memory, browsers don’t create UI elements on the heap for elements on the pages itself so it wont matter what is on the pages it’s the browsers elements that count.

http://support.microsoft.com/kb/126962/ describes this and http://www.microsoft.com/downloads/details.aspx?familyid=5CFC9B74-97AA-4510-B4B9-B2DC98C8ED8Bdisplaylang=en the heap monitor will allow you to see how different programs consume resources on the heap.

So but I agree that this limit is fairly low but it seems it hasn’t been changed since NT 3.51, and taking into account that computers today have both more memory that is faster as well and faster CPU’s I would think it would be OK to extend this a bit

So you actually had time to sit there and open that many webpages?

Jeff, methinks you have jumped the shark.

:slight_smile:

Thanks very much to Kjartan and The Geek for pointing me to the solution.

This is indeed a desktop heap limitation.

I followed the registry editing instructions on Ed Bott’s blog ( http://blogs.zdnet.com/Bott/?p=269 ) and after increasing the heap size from 3096 to 8192, I can open 50+ tabs in IE7 now.

So we were running into one of Raymond’s fabled operating system limits. This is the kind of low-level OS tweak I’d expect to perform under Linux, certainly not for a consumer desktop OS.

(note that 64-bit editions of Windows have a much larger desktop heap by default, so this wouldn’t be an issue for them)

http://blogs.msdn.com/ntdebugging/archive/2007/01/04/desktop-heap-overview.aspx
http://blogs.msdn.com/ntdebugging/archive/2007/07/05/desktop-heap-part-2.aspx
http://blogs.msdn.com/ntdebugging/archive/2007/09/13/talkback-video-desktop-heap.aspx

I think another good example is how many open socket connections you can have on Windows. The limit is typically somewhere around 2000. That may seem like a lot. But when you factor in the fact that windows does not immediately close a socket connection when you are done with it you can quickly run up against the OS limit. Windows will keep a socket connection open for an extra two minutes after you’ve closed it (there is a registry setting to change this default). So actually, you can only open about 17 socket connections per second over a two minute period before getting an error. That really isn’t very many for server applications that might have a lot of network traffic (database connection, read/write to client, etc).

So the point being made here is very valid. Most OS limits are of a decent magnitude. But every now and then you find one that is set much lower than you would expect even under fairly moderate load.

39 IE windows open at once? 47 tabs?
Am I the only one that thinks that is nuts? I figure I have four or five open at once. 39? How the hell to you keep up with that?

I, too, open large amounts of tabs in Firefox when I’m surfing.
Click first, read later.

Well, when Firefox crashes, which it does as often as IE7 on my system, at least when I open it back up, it will load all those pages again.

They both have their faults, and some are worse on some systems than others on other systems

Interestingly enough, when I opened roughly 130 tabs of Microsoft.com, Firefox became slow, and when I closed all but one, the control key was stuck on, I scrolled and zoomed in… whoops.

@Jeff “The Tab” Atwood:
You’re bringing up a good point about setting hard limits, but once again I’m horrified by your working style. Opening 50 tabs is not being a “power user,” it’s just being “mental.”

My normal environment is 3 vs2008 instances, 1 blend, 1 expression design, 3 firefox (@15 tabs) , 3 windows explorer, outlook, onenote, word, itunes playing, and whatever i’m debugging. Needless to say I push my poor 32 bit company laptop. Thanks for the tips.

Granted I’m in XP, I managed to open 706 Firefox tabs, and roughly 660MB of memory. Right now I’m typing and it shows up about 5-10 seconds later, but every other program seems fine. Opening that many new tabs does seem kinda unreasonable, but it’s possible.

This should become a contest…or a survey…
Jeff, you pick a web page, and we could offer our user names, system configs and browser, and test how many tabs or windows we can open of that page.

The results could be: how many can be opened before browser hangs horribly, and when it completely stops. Also, who gets a BSOD, hehe.

Is this 50+ tabs in one window or multiple tabs in multiple windows? Either way it sounds unwieldy.

Have you tried Sleipnir, a IE based browser with hierarchical tabs? multiple tabs in one window, but you know what tab spawned another tab. Then again, you’re a multi-monitor user so having multiple browser windows maximized to a particular screen is a given.

I run into this too. I regularly have 50+ tabs open in a window in firefox, and I tend not to restart my machine, so programs end up lurking in the background just in case I need them (since restarting them takes so much time…). You’re not alone, Jeff!

Well, when Firefox crashes, which it does as often as IE7 on my system, at least when I open it back up, it will load all those pages again.

That’s the sole reason I switched to Firefox. I wish I were using IE, I prefer its other features, but it has forced me to piece together whatever twenty-odd tabs I had open too many times, now.

If any IE guys read this blog, I hope you’re paying attention.

I have had, on at least one occasion, 150 Firefox tabs open. On a C7 processor, no less.

I read a lot of webcomics, and I’m a member of the SomethingAwful forums. I have at least 20 threads open at any one time. I open webcomics in new tabs to remind me to read them, and slowly go through them - sometimes too slowly, admittedly, but I get through them. The computer is a dedicated chat/webbrowsing/email computer, so it’s not like it’s taking up space on my work computer - it’s just a box full of Things To Do Someday.

Interestingly, while Firefox handles that many tabs fine in terms of “allowing it to happen”, it absolutely crashes and burns in CPU and RAM usage. I’ve seen Firefox hit literally 600mb of RAM used, and a constant 60-70% CPU used. Still, that’s better than simply not allowing it.

I think the concept is that each IE7 window can have any number of tabs open, as every number is equal to 47…

Ok, yeah, that’s just someone at Microsoft playing a really bad geek joke.

http://en.wikipedia.org/wiki/47_%28number%29#In_pop_culture