To correct this problem, all we need to do is increase the size of the desktop heap. That sounds simple but it actually requires us to edit the registry using the Registry Editor.
Editing the registry comes with a certain degree of risk. You may cause serious problems that may require you to reinstall Windows. If you have experience editing the registry, then doing so may not pose much of a problem. But if you have never tried editing the registry before, it's highly advisable you obtain the assistance of someone with experience.
Okay, if you are ready, let's get on with it!
- Run the Registry Editor (usually found as drive:\Windows\regedit.exe).
- Go to HKEY_LOCAL_MACHINE -> SYSTEM -> CurrentControlSet -> Control -> Session Manager -> SubSystems.
- Double-click on the Windows string to edit it.
- If you check the Value data, it should be something like this :-
%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
- The portion of interest is "SharedSection=1024,3072,512".
The three values under Shared Section determines how much memory in kilobytes (KB) is allocated to each component of the desktop heap.
The first value is the shared heap size, common to all desktops. It's used to store the global handle table and shared system settings.
By default, it's set to 1024KB. You generally do not need to modify this value.
The second value is the desktop heap size for each desktop associated with the "interactive" window station. It's used to store user objects like hooks, menus, strings and windows.
By default, it's set to 3072KB. The more users log into the system, the more desktops are created. Consequently, the total "interactive" desktop heap size will increase to reflect the number of desktops created. But each desktop will only have an "interactive" desktop heap of 3072KB.
The third value is the desktop heap size for each desktop associated with the "non-interactive" window station.
By default, it's set to 512KB. But if this value is not present, the size of the "non-interactive" window station will be the same as that of the "interactive" window station.
Every service process created under a user account will be given a new desktop in a "non-interactive" window station created by the Service Control Manager (SCM). Therefore, each of these services will consume the amount of desktop heap, as specified in the third SharedSection value.
- The total desktop heap used in both interactive and non-interactive window
stations must fit into the 48MB system-wide buffer.
Consequently, decreasing the second or third SharedSection values will increase the number of desktops that can be created. But it will reduce the number of hooks, menus, strings and windows that can be created within each desktop.
On the other hand, increasing the second of third SharedSection values will reduce the number of desktops that can be created. But it will increase the number of hooks, menus, strings and windows that can be created within each desktop.
In addition, increasing the third SharedSection value will reduce the number of user account services that can run successfully on the system.
- To solve the problem we are facing, just increase the desktop heap for
"interactive" window stations, which is the second SharedSection
value. By default, it's set to 3072KB.
Try increasing it to 4096KB or to a higher value that addresses your problem. But please note that increasing this value will reduce the number of desktops that can be created.
- Reboot the system for the changes to take effect.
That's it! Your system will now have a larger "interactive" desktop heap!