You are currently offline, waiting for your internet to reconnect

You may receive an "Out of Memory" error message because of the desktop heap limitation

Symptoms
After you open many application windows in Windows, you may be unable to open any additional windows. Sometimes, a window may open. However, it will not contain the expected components. Additionally, you may receive an error message that resembles the following:
Out of Memory
Cause
This problem occurs because of the desktop heap limitation. If you close some windows, and then you try to open other windows, these windows may open. However, this method does not affect the desktop heap limitation.
Resolution
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 have us fix this problem for you, go to the "Fix it for me" section. If you prefer to fix this problem yourself, go to the "Let me fix it myself" section.

Fix it for me



To fix this problem automatically in Vista and Windows 7, click the Fix itbutton or link. Click Runin the File Download dialog box, and follow the steps in the Fix it wizard.



Notes
  • This wizard may be in English only. However, the automatic fix also works for other language versions of Windows.
  • If you are not on the computer that has the problem, save the Fix it solution to a flash drive or a CD and then run it on the computer that has the problem.
  • We increase the second value of the SharedSection registry entry to 20480 and increase the third value of the SharedSection registry entry to 1024 in the automatic fix.

Then, go to the "Did this fix the problem?" section.



Let me fix it myself


To resolve this problem, modify the desktop heap size. To do this, follow these steps:
  1. Click Start, type regedit in the Start Search box, and then click regedit.exe in the Programs list.

    Note If you are prompted for an administrator password or for confirmation, type your password, or click Continue.
  2. Locate and then click the following registry subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems
  3. Right-click the Windows entry, and then click Modify.
  4. In the Value data section of the Edit String dialog box, locate the SharedSection entry, and then increase the second value and the third value for this entry.
Notes
  • The second value of the SharedSection registry entry is the size of the desktop heap for each desktop that is associated with an interactive window station. The heap is required for each desktop that is created in the interactive window station (WinSta0). The value is in kilobytes (KB).
  • The third SharedSection value is the size of the desktop heap for each desktop that is associated with a "non-interactive" window station. The value is in kilobytes (KB).
  • We do not recommend that you set a value that is over 20480 KB for the second SharedSection value.
By default, the Windows registry entry contains the following data in an x86-based version of Windows Vista.
%SystemRoot%\system32\csrss.exeObjectDirectory=\WindowsSharedSection=1024,3072,512Windows=OnSubSystemType=WindowsServerDll=basesrv,1ServerDll=winsrv:UserServerDllInitialization,3ServerDll=winsrv:ConServerDllInitialization,2ProfileControl=OffMaxRequestThreads=16
Note By default, the second value for the SharedSection entry is 3072 in an x86-based version of Windows Vista. By default, this second value for this entry is 20480 in an x64-based version of Windows Vista.

Windows Vista SP1, 7, 8, 8.1 (32bit) / Windows Server 2008 (32bit)
SharedSection=1024, 12288,512

Windows Vista, 7, 8, 8.1 (64bit) / Windows Server 2008, 2008 R2, 2012, 2012 R2 (64bit)
SharedSection=1024, 20480,768


In Windows Vista and in later operating systems, memory allocations are dynamic. Therefore, there is no limitation for memory allocation. However, if you allocate too much memory to the desktop heap, negative performance may occur. This is the reason why we do not recommend that you set a value that is over 20480.

Note The desktop heap size is not affected by the physical RAM on the computer. Therefore, you cannot improve the performance by adding physical RAM.
References
For more information about similar issues, click the following article numbers to view the articles in the Microsoft Knowledge Base:
126962 "Out of Memory" error message appears when you have a large number of programs running
318677 PRB: Cannot create more child windows and other problems when you reach the maximum number of allowable child windows in an MDI application
For more information about the session memory issue in a Terminal Services environment, click the following article number to view the article in the Microsoft Knowledge Base:
840342 Applications may not run correctly in a Terminal Services environment

For more information about the desktop heap, visit the following Microsoft Web site:

Did this fix the problem?

  • Check whether the problem is fixed. If the problem is fixed, you are finished with this section. If the problem is not fixed, you can contact support.
  • We would appreciate your feedback. To provide feedback or to report any issues with this solution, please leave a comment on the "Fix it for me" blog or send us an email.
fixit fix it fixme
Properties

Article ID: 947246 - Last Review: 08/06/2015 17:48:00 - Revision: 4.0

Windows Vista Enterprise 64-bit Edition, Windows Vista Home Basic 64-bit Edition, Windows Vista Home Premium 64-bit Edition, Windows Vista Ultimate 64-bit Edition, Windows Vista Business, Windows Vista Business 64-bit Edition, Windows Vista Enterprise, Windows Vista Home Basic, Windows Vista Home Premium, Windows Vista Ultimate, Windows 7 Enterprise, Windows 7 Home Basic, Windows 7 Home Premium, Windows 7 Professional, Windows 7 Ultimate, Windows 7 Starter, Windows 8, Windows 8 Enterprise, Windows 8 Pro, Windows 8.1, Windows 8.1 Enterprise, Windows 8.1 Pro, Windows Server 2008 Datacenter, Windows Server 2008 Enterprise, Windows Server 2008 Standard, Windows Server 2008 R2 Datacenter, Windows Server 2008 R2 Enterprise, Windows Server 2008 R2 Standard, Windows Server 2012 Datacenter, Windows Server 2012 Standard, Windows Server 2012 R2 Datacenter, Windows Server 2012 R2 Standard

  • kbprb kbtshoot kbexpertiseadvanced kbfixme kbmsifixme KB947246
Feedback