Depending on the type of workload your Agents generate on your server, it may be advantageous for you to tune the windows heap setting so that you can run more concurrent processes on your windows server. Symptoms of running up against windows default system configuration limits are "Out of Memory" errors or errors that say "Error creating window handle". An example of a specific error message is "System.ComponentModel.Win32Exception (0x80004005): An attempt was made to reference a token that does not exist" which can be caused by a failure to create a new Windows handle.
When you run a large number of Windows-based programs, these error messages appear when you attempt to start new programs or try to use programs that are already running, even though you still have plenty of physical and pagefile memory available.
Make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. See this link for instructions on how to back up and restore the registry.
To increase the size of the desktop heap:-
Run Registry Editor (Regedt32.exe).
From the HKEY_LOCAL_MACHINE subtree, go to the following key:
Select the Windows value.
From the Edit menu, choose String.
Increase the SharedSection parameter.
For Windows NT:
SharedSection specifies the system and desktop heaps using the
The SharedSection key is a long string when viewed using Registry Editor.
By default the value for this key is as follows:-
%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,3072,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:GdiServerDllInitialization,4 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16
CHANGE IT TO
( %SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,20480,2048 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=sxssrv,4 ProfileControl=Off MaxRequestThreads=16 )
If your system has significant memory resources that are going unused, and you are seeing errors that say "Error creating window handle", you may want to increase heap settings further:
( %SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,20480,4096 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=sxssrv,4 ProfileControl=Off MaxRequestThreads=16 )