Desktop Heap Limitations


If you have a lot of applications open one thing you might notice is that Windows — even XP — will reach a point where no more windows can be opened. For me, IE hits this point after about 40-50 windows. Depending on what else you have running, you may be able to open more or less.


Usually this is not a problem, but if you find yourself running into this limit the workaround is to increase the Desktop Heap. To do this, edit the following key in the registry:


[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems]
Windows=”%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″


and change 3072 to a larger value such as 4096. Always use caution when editing your registry; standard disclaimers apply.


For more information see: http://support.microsoft.com/default.aspx?scid=kb;EN-US;184802


Note: 64-bit versions of Windows have a much larger default desktop heap limit, and you should not hit this issue.


EDIT: The new NT Debugging blog has a post that talks in greater deal about Desktop Heap and how to troubleshoot issues: http://blogs.msdn.com/ntdebugging/archive/2007/01/04/desktop-heap-overview.aspx


Comments (9)

  1. Luke says:

    Would this relate to the issue i get on XP, where if i have to many windows open (say 20+) multiple windows of:

    – Word documents

    – Firefox

    – Vis studio 6

    – Outlook

    – Enterprise Manager

    If i try and open one more app, say internet explorer, that the window will not render properly (Menus not displayed, toolbars not showing)

    but if i close one of the other open windows

    and reopen internet explorer everything is fine?

  2. Kevin Dente says:

    This issue has been a huge problem for me – fortunately, I discovered the solution some time ago. On my work machine, I’ve experienced the problem with as few as 8-9 IE windows open.

  3. Luke, yep those are the symptoms.

    Kevin, 8-9 IE windows by themselves won’t cause this; it depends on what else you have open.

  4. Dr Pizza says:

    This is one of Windows’ lamest limitations. One would have hoped that IE, using mostly windowless controls, wouldn’t eat large chunks of desktop heap, but it seems to.

    One would also have hoped that these buffers could be allocated from a process (presumably they lie in the kernel, hence the tiny 48 MB limit), and that that process would be one per windowstation.

  5. __hAl__ says:

    Weird this has never been a configurable opties in the IE settings then cause this is one of the most common malfunctions on my computer.

  6. Kevin Dente says:

    >Kevin, 8-9 IE windows by themselves won’t cause

    >this; it depends on what else you have open.

    And yet, that’s what I’ve experienced. Of course, Windows is never running only one app – god knows what other system processes are sucking up desktop heap. The problem was far worse on my work machine (an IBM desktop) than on any other machine I’ve used, so it may have been due to some crazy software IBM preinstalled, or a specific video driver, or something else particular about that machine. But the problem was there, nonetheless.

    Is there a way of checking the current usage of the desktop heap? A perfmon counter, for example?

  7. zzz says:

    If Longhorn can’t open 1000 windows of any sorts atleast then it will be a huge disappointment..

    Also for IE a must feature is the ability to save the stuff I have open even through a full reboot with no pagefile! So 200 IEs open with 1000 tabs in them total must be saved if I want..

  8. Last week Tony on the IEBlog announced (or confirmed depending on your POV) that IE7 would have tabs…

  9. Mike H says:

    It’s my undertanding that any desktop associated with an interactive windowstation would, in your example end up being 4096 instead of 3072. Further, desktop allocation comes from a system-wide allocation that defaults to 48MB on XP and 2003.

    I think WinSta0 has three desktops in it by default: Default, Winlogon and Disconnect if I’m looking at the right stuff. So, for WinSta0 does the 48MB default total take a hit of 3*4096?

    If Terminal Server is enabled there are other interactive windowstations. It looks like one for each session. Each session appears to have the same three desktops. So does each Terminal Server session deduct 3*4096 from the 48MB?

    Allowing for non-interactive desktops (512kb in your example), and lots of Terminal Server sessions, would 48MB also conceivably pose a resource restriction? When the 48MB is exhausted, it that when the Event ID 243 "A desktop heap allocation failed?"