Increasing the Desktop Application Heap

Last reviewed: May 30, 1997
Article ID: Q126962

The information in this article applies to:
  • Microsoft Windows NT Workstation version 3.5
  • Microsoft Windows NT Server version 3.5
  • Microsoft Windows NT operating system version 3.1
  • Microsoft Windows NT Advanced Server version 3.1

SYMPTOMS

When you run a large number of Windows-based applications, Out Of Memory errors appear when you attempt to start new applications or try to use applications that are already running, even though you still have plenty of physical and pagefile memory available.

CAUSE

You depleted the desktop heap in the WIN32 sub-system.

NOTE: This problem occurs more often under Windows NT 3.5 as the default size of the desktop heap is 512K. Under Windows NT 3.1 the default value is 3072K. The default was reduced to increase performance.

RESOLUTION

To correct this problem, increase the size of the desktop heap:

WARNING: Using Registry Editor incorrectly can cause serious, system-wide problems that may require you to reinstall Windows NT to correct them. Microsoft cannot guarantee that any problems resulting from the use of Registry Editor can be solved. Use this tool at your own risk.

  1. Run Registry Editor (REGEDT32.EXE).

  2. From the HKEY_LOCAL_MACHINE subtree, go to the following key:

          \System\CurrentControlSet\Control\Session Manager\SubSystems
    

  3. Select the Windows key.

  4. From the Edit menu, choose String.

  5. Increase the SharedSection parameter.

    SharedSection specifies the system and desktop heaps using the following format:

          SharedSection=xxxx,yyyy
    

    where xxxx defines the maximum size of the system-wide heap (in kilobytes) and yyyy defines the size of the per desktop heap. The default value of the per desktop heap under Windows NT 3.5 (512K) can support approximately 2,500 windows. Increasing the desktop heap by 256K or 512K normally provides enough memory to correct Out of Memory errors.

MORE INFORMATION

Windows NT uses a special memory heap for all windows applications running on the desktop. The desktop heap is used for all objects (windows, menus, pens, icons, etc.). When a large number of Windows-based applications are running, this heap may run out of memory. When there is not enough memory to satisfy an allocation request, the system normally returns an error and notifies the user that they are running low on memory. Some applications do not handle the failure gracefully, and in some cases there may not be enough memory to create the error dialog box. As a result, the requested operation fails without any indication.

The SharedSection key is a long string when viewed using Registry Editor. The default value for this key under Windows NT 3.5 is:

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

The first SharedSection value (1024) defines the head size common to all desktops. This includes the global handle table (Window handles are unique machine wide) and shared system settings (such as SystemMetrics). It is unlikely you would ever need to change this value.

The second SharedSection value (512) controls the size of the desktop heap (used for Windows objects). A static value used to prevent ill-behaved applications from consuming too many resources. Because the desktop heap is mapped into each process' address space, this value should not be set to an arbitrarily high value (as it would decrease performance).

but should only be increased sufficiently to allow all the desired applications to run.


Additional query words: prodnt low failure fixed size page
file
Keywords : kbenv ntconfig
Version : 3.1 3.5
Platform : WinNT


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.