Desktop Heap limitation

Desktop Heap limitation

When running lots of applications, one may notice a moment where no more windows can be opened. This is the Desktop Heap limit; you will see this logged in the Event log as A desktop heap allocation failed

Back when I was running Windows Xp I hit this limit quite often (because of my working habits). The solution was to increase the limit; for this one needs to edit a specific registry key (always backup first!):

In Window Xp this is:

[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"

After setting the second (bold) value to 8192 I had never hit the limit again.

I haven’t reached this limit in Windows 7 x64 yet, but I’m writing down the defaults just to have them somewhere (as one can see, the limit in 64bit is quite a bit higher):

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

Leave a Reply