Friday, September 4, 2009

How to fix: "shared heap exhausted or damaged"

The error can occur because your desktop heap is too small. This happened to me especially after opening a large number of windows.

Nview then filled up the application log with the error message:

"NVIEW : Explorer: shared heap exhausted or damaged"

Quick Solution:

1.) Start Regedit:

2.) Browse to

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems

3.) Open the "Windows" key

In the string you find a section like

....Windows SharedSection=1024,4096,512....

Edit the second value e.g.

Windows SharedSection=1024,8192,512

Click OK

4.) Restart Windows

To verify this solution is the correct one for you can:

1. ) Download dheapmon

2.) Open a command shell (Start - Run - "CMD")

3.) Change your directory to the location of the executables (e.g. C:\kktools\dheapmon8.1\x86)

4.) Type: dheapinst.exe -y srv*

5.) Type: dheapmon -l

6.) Type: dheapmon

Now you see:

If you see a high utilization of the "WinSta0\Default " session e.g.:

WinStation\Desktop Heap Size(KB) Used Rate(%)
WinSta0\Default 4096 95,6

then the above solution will do the job for you because:

The second SharedSection value (3072) is the size of the desktop heap for each desktop that is associated with the "interactive" window station WinSta0. User objects like hooks, menus, strings, and windows consume memory in this desktop heap."


As always be careful with what you do. Modifying your registry has the potential to render your system useless.