Applications may not run correctly in a Terminal Services environment


When you use a Terminal Services session to connect to a Windows Server 2003-based computer that has Terminal Services installed, and then you try to run a program on the Terminal server from a client computer, the program that you are trying to run may not run correctly.


This problem occurs if the session memory cannot allocate graphical user interface (GUI) objects to applications. The session memory in a Terminal server manages the allocation of GUI objects to different applications. If the session memory that is assigned to GUI objects is not sufficient, GUI objects will not be correctly allocated to applications that run on the Terminal server. This may cause applications not to run correctly.


Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, 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. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 How to back up and restore the registry in Windows

To configure the session memory, you can manually modify the registry entries for the session memory in the registry. The registry entry for modifying the session memory is located under the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
The two registry entries that manage the session memory are SessionViewSize and SessionPoolSize. The SessionViewSize registry entry specifies the amount of memory that is reserved for desktop heaps. The default value of this entry is 20 megabytes (MB). This memory is allocated for applications to use GUI objects such as fonts, menus, and windows.

The SessionPoolSize registry entry specifies the session paged pool in megabytes. The default value for the session paged pool is 16 MB. If sufficient memory is available, Windows may also allocate 32 MB. This memory is used for video driver allocations.

In a 64-bit operating system, the default value for the SessionViewSize entry is 104 MB and the default value for the SessionPoolSize entry is 64 MB. The best way to increase the memory allocated to both the SessionViewSize and SessionPoolSize entries is to increase the value of memory allocated by 16 MB, and then see whether the services are available to run applications after you increase the value of memory allocated to the SessionViewSize and SessionPoolSize entries. If not, increase the value of memory allocated by 16 MB and try again.

To change the values of the SessionViewSize and SessionPoolSize registry entries, use Registry Editor to edit the DWORD values of both registry entries. Also, you can change SessionViewSize and SessionPoolSize registry entry values separately.

Note In 64-bit Windows operating systems, the Graphical Device Interface (GDI) handle limit is not increased over that of 32-bit Windows operating systems. The maximum number of GDI handles that one process can handle is 65,535. You can restrict the number of GDI handles that each process may handle by setting the following registry value:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\ CurrentVersion\Windows

Value name: GDIProcessHandleQuota
Value type: REG_DWORD
Value data: 10000 (default decimal value)
You can set this registry value from a minimum value of 256 (decimal) to a maximum value of 65536 (decimal).

In an ideal condition, the total memory allocated to the SessionViewSize and SessionPoolSize registry entries must not be more than 512 MB. You may also increase the memory allocated to the SessionViewSize and SessionPoolSize entries, depending upon your RAM and other related registry values. If you allocate more memory to increase the desktop heap, you may reduce the memory that allocated by the Terminal server to other resources, such as nonpaged pool, paged pool, and system cache. This will affect the performance of the Terminal server. Also, when more memory is allocated to the SessionViewSize and SessionPoolSize entries, the memory allocated to map the kernel virtual space will be reduced. This in turn may make the Terminal server to support only a limited number of users.

Article ID: 840342 - Last Review: Oct 22, 2008 - Revision: 1