<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>Paul Mrozowski's Blog - Windows</title>
    <link>http://www.rcs-solutions.com/blog/</link>
    <description>A day in the life (of a developer)</description>
    <language>en-us</language>
    <copyright>Paul Mrozowski / RCS Solutions, Inc.</copyright>
    <lastBuildDate>Wed, 05 Dec 2007 02:23:59 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>paulm@rcs-solutions.com</managingEditor>
    <webMaster>paulm@rcs-solutions.com</webMaster>
    <item>
      <trackback:ping>http://www.rcs-solutions.com/blog/Trackback.aspx?guid=57ea8142-3bfe-43eb-a441-b84ab4e98a63</trackback:ping>
      <pingback:server>http://www.rcs-solutions.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.rcs-solutions.com/blog/PermaLink,guid,57ea8142-3bfe-43eb-a441-b84ab4e98a63.aspx</pingback:target>
      <dc:creator>Paul Mrozowski</dc:creator>
      <wfw:comment>http://www.rcs-solutions.com/blog/CommentView,guid,57ea8142-3bfe-43eb-a441-b84ab4e98a63.aspx</wfw:comment>
      <wfw:commentRss>http://www.rcs-solutions.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=57ea8142-3bfe-43eb-a441-b84ab4e98a63</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
While I'm working, I tend to open a LOT of windows (and leave them open). That way
I'm not wasting time navigating around to the same places again and again. It's almost
physically painful for me to watch other users open something like Explorer, spend
the time navigating to a folder to do something like copy a file, then close the window
(to satisfy some notion of keeping their desktop "Clean", I guess). Then, two minutes
later, open Explorer again, navigate to the SAME folder, to do something else. I've
found if I've spent the time opening some app., a website, etc. I'm very likely to
need to have access to the same window a few more times within a fairly short period
of time. In addition, there are a bunch of windows I leave open all the time. Things
like one or more DOS prompts, maybe a few instances of Explore, Firefox w/a bunch
of tabs open in each, SQL Management Studio, VFP, Visual Studio, Excel, Outlook, etc.
Besides using up memory, there is very little downside (and my desktop at work and
at home have 4GB, so I usually have a bit of memory to spare). I also don't reboot
very often; sometimes weeks at a time if I can help it.<br /></p>
        <p>
However, I still occasionally notice that things sometimes start to get flaky. I'll
try right-clicking on a table in SQL Management studio to browse a table and the context-menu
doesn't appear. Or I'll open IE and some of the menus are missing. Or Windows Explorer
isn't "painting" correctly. Whatever. It seemed to be related to the number of programs
open - not necessarily the amount of free memory. I'd did some digging and it seems
to be related to the desktop heap. I found a great link which goes into detail about
it:
</p>
        <p>
          <br />
          <a href="http://blogs.msdn.com/ntdebugging/archive/2007/01/04/desktop-heap-overview.aspx">http://blogs.msdn.com/ntdebugging/archive/2007/01/04/desktop-heap-overview.aspx</a>
        </p>
        <p>
          <br />
I ended up downloading the dheapmon tool mentioned and installing it. It has to be
installed from the command prompt and requires access to the symbol libraries. I don't
have them installed on my machine, so I ended up using the environment variable mentioned
in the CHM file.
</p>
        <p>
          <br />
          <font face="Courier New" size="2">C:\&gt;cd \kktools\dheapmon8.1\x86<br />
C:\kktools\dheapmon8.1\x86&gt;SET _NT_SYMBOL_PATH=symsrv*symsrv.dll*C:\Symbols*</font>
          <font face="Courier New" size="2">http://msdl.microsoft.com/download/symbols</font>
          <br />
          <font face="Courier New" size="2">C:\kktools\dheapmon8.1\x86&gt;</font>
          <font face="Courier New" size="2">dheapinst.exe<br />
C:\kktools\dheapmon8.1\x86&gt;dheapmon -l<br />
C:\kktools\dheapmon8.1\x86&gt;dheapmon</font>
        </p>
        <p>
          <br />
          <font face="Courier New" size="2">Desktop Heap Information Monitor Tool (Version 8.1.2925.0)<br />
Copyright (c) Microsoft Corporation.  All rights reserved.<br />
-------------------------------------------------------------<br />
  Session ID:    0 Total Desktop: (  5824 KB -   
8 desktops)<br />
  WinStation\Desktop           
Heap Size(KB)    Used Rate(%)<br />
-------------------------------------------------------------<br />
  WinSta0\Default                   
3072             <span style="background: yellow">91.8</span><br />
  WinSta0\Disconnect                  
64              4.5<br />
  WinSta0\Winlogon                   
128             10.1<br />
  Service-0x0-3e7$\Default           
512             27.0<br />
  Service-0x0-3e4$\Default           
512             11.9<br />
  Service-0x0-3e5$\Default           
512             
4.3<br />
  SAWinSta\SADesktop                 
512             
0.5<br />
  __X78B95_89_IW\__A8D9S1_42_ID       512             
0.5<br />
-------------------------------------------------------------<br />
C:\kktools\dheapmon8.1\x86&gt;</font>
        </p>
        <font face="Courier New">
          <p>
            <br />
          </p>
        </font>It looked like the WinSta0\Default was the issue; I'm at 91.8% usage. I
followed the docs and it looked like I should modify the Windows registry key located
here:<br /><font face="Courier New">HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems\<br /></font><p>
It was set to:<br /></p><p><font face="Courier New">%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<br /></font></p><p>
I changed it to:<br /></p><p><font face="Courier New">%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows
SharedSection=1024,4096,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3
ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16</font></p><p><br />
(note that I changed the "3072" to "4096"). This should give me a bit more heap, so
hopefully this will help. It looks like you have to reboot after making this kind
of change, so it'll be a bit before I can tell whether it's really fixed the issue
or not. I'm hopeful. If not, I'll probably try bumping it up a bit more.
</p><p><strong>Links</strong><br /><a href="http://blogs.msdn.com/ntdebugging/archive/2007/01/04/desktop-heap-overview.aspx">http://blogs.msdn.com/ntdebugging/archive/2007/01/04/desktop-heap-overview.aspx</a></p><img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=57ea8142-3bfe-43eb-a441-b84ab4e98a63" /></body>
      <title>The Desktop Heap</title>
      <guid isPermaLink="false">http://www.rcs-solutions.com/blog/PermaLink,guid,57ea8142-3bfe-43eb-a441-b84ab4e98a63.aspx</guid>
      <link>http://www.rcs-solutions.com/blog/2007/12/05/TheDesktopHeap.aspx</link>
      <pubDate>Wed, 05 Dec 2007 02:23:59 GMT</pubDate>
      <description>&lt;p&gt;
While I'm working, I tend to open a LOT of windows (and leave them open). That way
I'm not wasting time navigating around to the same places again and again. It's almost
physically painful for me to watch other users open something like Explorer, spend
the time navigating to a folder to do something like copy a file, then close the window
(to satisfy some notion of keeping their desktop "Clean", I guess). Then, two minutes
later, open Explorer again, navigate to the SAME folder, to do something else. I've
found if I've spent the time opening some app., a website, etc. I'm very likely to
need to have access to the same window a few more times within a fairly short period
of time. In addition, there are a bunch of windows I leave open all the time. Things
like one or more DOS prompts, maybe a few instances of Explore, Firefox w/a bunch
of tabs open in each, SQL Management Studio, VFP, Visual Studio, Excel, Outlook, etc.
Besides using up memory, there is very little downside (and my desktop at work and
at home have 4GB, so I usually have a bit of memory to spare). I also don't reboot
very often; sometimes weeks at a time if I can help it.&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
However, I still occasionally notice that things sometimes start to get flaky. I'll
try right-clicking on a table in SQL Management studio to browse a table and the context-menu
doesn't appear. Or I'll open IE and some of the menus are missing. Or Windows Explorer
isn't "painting" correctly. Whatever. It seemed to be related to the number of programs
open - not necessarily the amount of free memory. I'd did some digging and it seems
to be related to the desktop heap. I found a great link which goes into detail about
it:
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
&lt;a href="http://blogs.msdn.com/ntdebugging/archive/2007/01/04/desktop-heap-overview.aspx"&gt;http://blogs.msdn.com/ntdebugging/archive/2007/01/04/desktop-heap-overview.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
I ended up downloading the dheapmon tool mentioned and installing it. It has to be
installed from the command prompt and requires access to the symbol libraries. I don't
have them installed on my machine, so I ended up using the environment variable mentioned
in the CHM file.
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
&lt;font face="Courier New" size="2"&gt;C:\&amp;gt;cd \kktools\dheapmon8.1\x86&lt;br&gt;
C:\kktools\dheapmon8.1\x86&amp;gt;SET _NT_SYMBOL_PATH=symsrv*symsrv.dll*C:\Symbols*&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;http://msdl.microsoft.com/download/symbols&lt;/font&gt;
&lt;br&gt;
&lt;font face="Courier New" size="2"&gt;C:\kktools\dheapmon8.1\x86&amp;gt;&lt;/font&gt;&lt;font face="Courier New" size="2"&gt;dheapinst.exe&lt;br&gt;
C:\kktools\dheapmon8.1\x86&amp;gt;dheapmon -l&lt;br&gt;
C:\kktools\dheapmon8.1\x86&amp;gt;dheapmon&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
&lt;font face="Courier New" size="2"&gt;Desktop Heap Information Monitor Tool (Version 8.1.2925.0)&lt;br&gt;
Copyright (c) Microsoft Corporation.&amp;nbsp; All rights reserved.&lt;br&gt;
-------------------------------------------------------------&lt;br&gt;
&amp;nbsp; Session ID:&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 Total Desktop: (&amp;nbsp; 5824 KB -&amp;nbsp;&amp;nbsp;&amp;nbsp;
8 desktops)&lt;br&gt;
&amp;nbsp; WinStation\Desktop&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
Heap Size(KB)&amp;nbsp;&amp;nbsp;&amp;nbsp; Used Rate(%)&lt;br&gt;
-------------------------------------------------------------&lt;br&gt;
&amp;nbsp; WinSta0\Default&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
3072&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: yellow"&gt;91.8&lt;/span&gt;
&lt;br&gt;
&amp;nbsp; WinSta0\Disconnect&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
64&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4.5&lt;br&gt;
&amp;nbsp; WinSta0\Winlogon&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
128&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10.1&lt;br&gt;
&amp;nbsp; Service-0x0-3e7$\Default&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
512&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 27.0&lt;br&gt;
&amp;nbsp; Service-0x0-3e4$\Default&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
512&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11.9&lt;br&gt;
&amp;nbsp; Service-0x0-3e5$\Default&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
512&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
4.3&lt;br&gt;
&amp;nbsp; SAWinSta\SADesktop&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
512&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
0.5&lt;br&gt;
&amp;nbsp; __X78B95_89_IW\__A8D9S1_42_ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 512&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
0.5&lt;br&gt;
-------------------------------------------------------------&lt;br&gt;
C:\kktools\dheapmon8.1\x86&amp;gt;&lt;/font&gt;
&lt;/p&gt;
&lt;font face="Courier New"&gt; 
&lt;p&gt;
&lt;br&gt;
&lt;/font&gt;It looked like the WinSta0\Default was the issue; I'm at 91.8% usage. I followed
the docs and it looked like I should modify the Windows registry key located here:&lt;br&gt;
&lt;font face="Courier New"&gt;HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems\&lt;br&gt;
&lt;/font&gt;&gt;
&lt;p&gt;
It was set to:&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;%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&lt;br&gt;
&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
I changed it to:&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows
SharedSection=1024,4096,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3
ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;
(note that I changed the "3072" to "4096"). This should give me a bit more heap, so
hopefully this will help. It looks like you have to reboot after making this kind
of change, so it'll be a bit before I can tell whether it's really fixed the issue
or not. I'm hopeful. If not, I'll probably try bumping it up a bit more.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Links&lt;/strong&gt;
&lt;br&gt;
&lt;a href="http://blogs.msdn.com/ntdebugging/archive/2007/01/04/desktop-heap-overview.aspx"&gt;http://blogs.msdn.com/ntdebugging/archive/2007/01/04/desktop-heap-overview.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.rcs-solutions.com/blog/aggbug.ashx?id=57ea8142-3bfe-43eb-a441-b84ab4e98a63" /&gt;</description>
      <comments>http://www.rcs-solutions.com/blog/CommentView,guid,57ea8142-3bfe-43eb-a441-b84ab4e98a63.aspx</comments>
      <category>Windows</category>
    </item>
  </channel>
</rss>