Max Num. of Open Windows under XP/2003/VISTA - Resolved !

When I'm working (it happens from now and then...) I always tend to open lots and lots of explorer windows as I Google for answers to questions that come along while coding...

When I used XP and Win 2003 it always bothered me that as soon as I opened 15-17 Internet explorer windows my system got stuck so hard that even right click context menu wouldn't seem to show up.

When I migrated to Vista I though that finally someone in MS will fix this limitation but I was disappointed to find out that it still there...

Well after looking and looking... searching and hacking ... I found the answer !

Its all about the desktop heap !

Following is Desktop Heap Tweak:

Because it is an undocumented registry tweak I take no responsibility regarding implementing this tweak ! It worked for me and if you choose to tweak your system you are doing it on your own risk.

Longtime Windows users are familiar with the desktop heap, a memory space that Windows allocates for desktop objects such as, well, windows.

Each open window or other desktop object uses up a certain amount of the desktop heap. In older versions of Windows the desktop heap was very small, and objects weren't always disposed from the heap correctly.

This was a good part of the reason for the Incredible Shrinking Resource Heap problem that plagued the 16 and hybrid 16/32-bit versions of Windows.

NT fixed this problem by devoting a far larger chunk of memory to the desktop heap -- but the fact that it had a far better memory manager than Win 3.x or Win9x, and a pure 32-bit architecture, didn't hurt either.

The desktop heap limit affects the NT/VISTA family of systems, Hitting the limit is manifested as either a DLL initialization error for USER32.dll or an out of memory error.

Fortunately, the limit it tweakable, the default settings are low enough that the limit is easily hit.

To tweak the limit, take a look in the registry at HLKM/System/CurrentControlSet/Control/Session Manager/SubSystems

(cranked up a bit if you find yourself manipulating a lot of desktop objects.)

Within that key is a subkey called Windows, which contains in it, among other things, the value "SharedSection=1024,3072"

Changing the SharedSection entry to "1024,3072,512" (note the comma and the value)increases the size of the "hidden" desktop heap.

If that doesn't work, try increasing the second of the comma delimited values (e.g. 3072 -> 4096) which is the size limit of any particular desktop heap.

Update: just to clarify for some pepole... on vista your default is 1024,3072,512 changing is to 1024,4096,512 will make the difference


  • Man.. you are an absolute star!! My messy style of working means that i've been plagued by this for years - nice one :-)

  • Even with IE7 tabs ?

  • Thanks Mark.

    And yes after patching the registry you are able to open lots of IE7 tabs what wasn't working pirior to tweaking the registry.

  • My Vista had it by default

    %SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,3072,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16

    Any ideas why?

  • On my windows xp professional sp2 latest patches this value is already set to 1024,3072,512!

  • Amazing. I've always had the same problem. I have to start using CTRL+TAB and ALT+F4 to get rid of a couple of windows so that I can actually work again. People are always gob-smacked when they see my desktop :)

  • Rajiv,Martin,

    I had the 1024,3072,512 already set on my vista too and changing it to 1024,4096,512 made the diffrence :)

  • Thanks for the tip. However, when I looked at my registry, mine is set to: 1024,20480,768

    I'm running a clean install of Windows Vista Ultimate edition. I have never modified this setting before, so I'm guessing it's the default value. Wonder why it's different for everyone else on here.

  • hey, yeh ive got vista and mine was preset with the 512...however i changed the 3072 to 4096 and it seems to have worked a charmed

  • i'm running vista ultimate and am facing this problem but only recently after i upgraded from 1GB memory to 2GB memory...great tip, will see if it works or not

  • worked for me too my limit was 32 open windows now it is at least 50
    thanks for the tip

  • Hey there, I was just wondering if this is the problem I am having - I don't get any error messages - just Internet Explorer refusing to load any more tabs and new windows refusing to load unless i close some currently open ones and sometimes even menus refusing to display?

    It's odd though because I have only started to experience it in the last few weeks and my working habits haven't changed - I do have LOTS of windows open at a time though so...

    In conclusion, does this problem lead to error messages as I don't get any!

  • Yes James, this is exactly the prob.

    And now you also know how to fix it :)


  • Man ytg

    I googled this problem and found no answers, figuring that it was a program that i just installed that was causing the problem and had never had this happen to me I was going to reinstall XP with all my other programs. (yes i uninstalled that specifique program first). Just before i went ahead and did that, i made a last attemp at finding an answer to this issue, man i found your site.

    thks a lot for posting this, saved me a days work of reinstalling all my stuff.

  • one more comment i set my Xp at (1024,20480,768). up to 100 open windows and still going , cool

    thks a lot, really

  • I'm more concerned with trying to identify what my app is allowed to do under Vista when not logged as admin under these obviously tight restrictions.

  • Well, I followed the info for windows Vista and its still happening!

    Its a brand new computer and it keeps freezing me out! Any ideas anyone?

  • This is a prayer answered.
    Thank you for the solution and "heartbreak",a friend, for finding this link for me :)

  • What about the disposal of objects? I've noticed that whenever I've hit this limit, and am unable to open additional windows, I then need to close more than one window to open up any additional. Thus, while my existing window count is decreasing, my new window count is not increasing by the same amount!

    What's the downside to increasing this value? Or effect of each increment added?

    "objects weren't always disposed from the heap correctly"

  • Can I set higher value than 4096 on 32bit Vista?

  • Yes you can, mine is set for 10240.

  • I'm running XPpro and the fix in this article still didn't help me. What should I try next? I see folks setting much higher values for Vista.. but how high can I go with XP? (Current values are 1024,4096,512)

    Also... what in the world causes this problem? It's like my computer just refuses to release these handles. I need to reboot every couple days because eventually I'm dwindled down to 3-4 windows and can't work anymore. It's got to be a program I install.. because the problem has followed me on my last 2 brand new work computers. No one else in my office has ever had this issue. Is it just the way I work?

  • Hi all,

    I am using a trading system to open up hundred of windows. The systems stops opening new windows at 440 windows.I would like to be able to 800 windows. Can some please help me solve the mystery. I'm using windows xp pro.

  • Default Values are :

    Vista32bit: 12MB
    Vista64Bit: 20MB
    XP32Bit: 03MB
    XP64Bit: 20MB

  • Thank you so much. Mine was already 512. so i altered it to the 4096? I'm looking forward to that changes. I am also glad i'm not the only one whom uses multiple windows. I use it for research.

    Explorer can be crashed by me on a brand new computer.
    *i've been to bestbuy and Blue screened all thier computers*


  • It does not work. I do not believe that the above statements are true, as this limitation is the product.

  • Christopher, it works. I've been doing this for years.

    Everyone, There are other things that you can do in addition to this if you need to open a lot of windows. I've forgotten exactly the names of the registry keys, but it involves increasing the maximum GDI objects, and maximum user objects.

    There is one more thing you can do. The shared section mentioned above comes out of a 48 mb buffer (on 32-bit operating systems). You can increase that number, but I can't remember the parameter.

    To Ohad Israeli, I highly recommend increasing the number to greater than 4 MB if you intend to open a lot of windows. I personally always use 12 MB because I routinely have 200 - 400 windows open. However 4 MB provides a huge boost over the default.

    I do want to disagree with one statement that you made. You state:
    The desktop heap limit affects the NT/VISTA family of systems, Hitting the limit is manifested as either a DLL initialization error for USER32.dll or an out of memory error.

    While that is technically true behind the scenes, the average user simply sees that a window does not open, with no error message at all. Only if a program properly handles the error message will the user see the error. Even Internet Explorer does not show an error message. In addition, even if a program attempts to properly handle the error message, it might not be able to as it may be unable to open a window in which it can display the error message.

  • Sweet! I work in multiple RDP windows while administering servers, and it looks as if those 'desktops' get built using this as well. Good find, sir!

  • The registry value that allows you to enlarge the 48MB buffer is SessionViewSize. Don't go crazy with it, but you can set it to 64 or 96 MB. Then you could set your shared section to 24MB.

    A couple of people spoke about the number of windows open becoming less over time. This is very true and is caused by memory leaks. Some of the leaks are from other programs and some are in Internet Explorer.

    It's easier for me to give you an example of how to reduce this problem than for me to give you the rules.

    Case 1. You open up a window with 10 tabs, then you close them all so that internet explorer closes. You do this 10 times so that in all you have opened up 100 windows, but the last time you leave all 10 windows open. You look in task manager and see that internet explorer is using 100 MB (this is just a made up number to illustrate the point).

    Case 2. You open up a window with 10 tabs, then you close 9 of them, then you open up another 9, then you close those 9, until in the end you have opened up 100 total windows, and you have 10 of them open now. You look in task manager and you see that internet explorer is using 150 MB.

    What you are looking at is a memory leak. Just like the memory is leaking, so are the maximum number of open windows. You don't recover that number until THAT instance of internet explorer is closed.

  • Umm... I have the '2137980928'. And what should I do?
    (Win XP SP2)

  • I can confirm that this works. I had windows server 2003 (32 bit)and was running multiple demos to test multiple strategies. After a few programs were open, I saw the slowdown. I tweaked the middle setting to 8032 and I was able to run many more demos. I will try increasing it further as I want to nearly max out my system resources. I was using a quad core with 2 gig ram.

    Would have been a waste if i didn't find this tweak to have so much system resources but couldn't use them.

Comments have been disabled for this content.