Microsoft KB Archive/126962

= "Out of Memory" error message appears when you have a large number of programs running =

Article ID: 126962

Article Last Modified on 2/20/2007

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Professional Edition
 * Microsoft Windows 2000 Datacenter Server
 * Microsoft Windows NT Workstation 3.5
 * Microsoft Windows NT Workstation 3.51
 * Microsoft Windows NT Workstation 4.0 Developer Edition
 * Microsoft Windows NT Server 3.5
 * Microsoft Windows NT Server 3.51
 * Microsoft Windows NT Server 4.0 Standard Edition
 * Microsoft Windows NT Advanced Server 3.1
 * Microsoft Windows XP Home Edition
 * Microsoft Windows XP Professional
 * Microsoft Windows Server 2003, Datacenter Edition (32-bit x86)
 * Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)
 * Microsoft Windows Server 2003, Standard Edition (32-bit x86)
 * Microsoft Windows Server 2003, Web Edition

-



This article was previously published under Q126962



Important This article contains information about how to modify the registry. Make sure to back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows registry



SYMPTOMS
When you run a large number of Windows-based programs, "Out Of Memory" 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.



CAUSE
This behavior can occur if the desktop heap in the WIN32 subsystem is depleted.

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
Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.To correct this problem, increase the size of the desktop heap:  Run Registry Editor (Regedt32.exe). From the  subtree, go to the following key:   Select the Windows value. From the Edit menu, choose String. 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 messages.</ol>

<div class="moreinformation_section">

MORE INFORMATION
Windows NT uses a special memory heap for all Windows-based programs running on the desktop. The desktop heap is used for all objects (windows, menus, pens, icons, etc.). When a large number of Windows-based programs 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 programs do not handle the failure gracefully, and in some cases there may not be enough memory to create the error message 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 is as follows. <pre class="fixed_text">  %SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,3072 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 heap 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 (3072) controls the size of the desktop heap (used for Windows objects). This static value is 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. For more information about the parameters of the SharedSection key, click the following article number to view the article in the Microsoft Knowledge Base:

184802 PRB: User32.dll or Kernel32.dll fails to initialize

Additional query words: prodnt low failure fixed size page file

Keywords: kbenv KB126962

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.