Subscribe to Windows IT Pro
April 13, 2009 12:00 AM

Conquer Desktop Heap Problems

Diagnose and solve problems that limit the memory available to Windows desktop sessions
Windows IT Pro
InstantDoc ID #101701
Rating: (4)

Before changing registry values, you should try to identify the process(es) consuming large amounts of desktop heap so that you become aware of the conditions on your system causing the depletion of desktop heap memory. One of the easiest ways to identify a large consumer of desktop heap is by using Task Manager: On the Processes Tab, click View, Select Columns, and check USER Objects. Click the top of the column to change the sort order to descending, so you can see the application or service consuming the most desktop heap resources. Identifying the desktop heap hog on your system is important because it may indicate a problem related to the service or application requiring further investigation—and simply adjusting registry settings to work around the problem might only mask the real issue. You can also use the information in Task Manager's USER Objects column to determine which application or service is consuming the largest amount of desktop heap on a Vista or Server 2008 system.

Session-View Space Registry Settings
For XP, Windows 2003, and Win2K, you can configure session-view space size by using the SessionViewSize registry value (REG_DWORD). You specify the size in megabytes. Note that on Vista and later systems, this value doesn't apply because the session view space grows as needed. The values listed in Table 1 are specific to 32-bit x86 systems not booted with the /3GB switch. You must reboot your system to effect this change. You specify the value under the subkey HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management.

If you need to change the size of a specific desktop heap—that is, when Used Rate (%) approaches 90%, you have two possible ways to do so, based on whether one of two conditions exist. The first condition occurs when the information from Dheapmon reveals a high used rate for a desktop heap belonging to an interactive window station (WinSta0) and isn't the Disconnect or Winlogon desktop. In this case, you can configure the desktop’s heap size using the SharedSection registry value (the second value—3072—for the SharedSection= entry in the registry listing in Figure 3). I'll explain these registry values in more detail shortly.

Figure 3: Sample default data for registry value controlling desktop heap size

%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 second condition occurs when the Dheapmon information reveals a high used rate for a desktop heap belonging to a non-interactive window station. In this case, you can also configure the desktop’s heap size suing the SharedSection registry value (the third value—512—for the SharedSection= entry in Figure 3). The size of each desktop heap allocation is controlled by the registry subkey HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\SubSystems\Windows. The default data for this registry value will look something like that in Figure 3 (it will appear on one line in your system's registry).

As mentioned, the numeric values following SharedSection= control how desktop heap is allocated. These SharedSection values are specified in kilobytes.

  • The first SharedSection value (1024) is the shared heap size common to all desktops. This memory isn't a desktop heap allocation, and you should not modify this value to address desktop heap problems.
  • The second SharedSection value (3072) is the size of the desktop heap for each desktop associated with an interactive window station (WinSta0), except for the Disconnect and Winlogon desktops.
  • The third SharedSection value (512) is the size of the desktop heap for each desktop associated with a non-interactive window station (usually a service). If this value isn't present, the size of the desktop heap for non-interactive window stations will be same as the size specified for interactive window stations (i.e., the second SharedSection value).

Changes in Vista SP1 and Server 2008
In the 32-bit versions of Vista SP1 and Server 2008, session view space is now a dynamic kernel address range. As I mentioned, the SessionViewSize registry value is no longer used. This is a big improvement and one of the reasons why you might not experience as many desktop heap issues running Vista or Windows Server 2008 as with earlier Windows versions. Additionally, the second value for the SharedSection location has changed to 12,288KB, which is the value for interactive desktop heaps.

The information I've given you here can better equip you to recognize desktop heap problems and resolve such issues on your own. As always I welcome your questions or stories about your own Windows troubleshooting experiences, with desktop heap or other OS issues.

Special thanks to Matthew Justice, a Microsoft software development engineer, who contributed significantly to this article.

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.