A day in the life (of a developer) RSS 2.0
 Tuesday, December 04, 2007

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.

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:


http://blogs.msdn.com/ntdebugging/archive/2007/01/04/desktop-heap-overview.aspx


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.


C:\>cd \kktools\dheapmon8.1\x86
C:\kktools\dheapmon8.1\x86>SET _NT_SYMBOL_PATH=symsrv*symsrv.dll*C:\Symbols*
http://msdl.microsoft.com/download/symbols
C:\kktools\dheapmon8.1\x86>dheapinst.exe
C:\kktools\dheapmon8.1\x86>dheapmon -l
C:\kktools\dheapmon8.1\x86>dheapmon


Desktop Heap Information Monitor Tool (Version 8.1.2925.0)
Copyright (c) Microsoft Corporation.  All rights reserved.
-------------------------------------------------------------
  Session ID:    0 Total Desktop: (  5824 KB -    8 desktops)
  WinStation\Desktop            Heap Size(KB)    Used Rate(%)
-------------------------------------------------------------
  WinSta0\Default                    3072             91.8
  WinSta0\Disconnect                   64              4.5
  WinSta0\Winlogon                    128             10.1
  Service-0x0-3e7$\Default            512             27.0
  Service-0x0-3e4$\Default            512             11.9
  Service-0x0-3e5$\Default            512              4.3
  SAWinSta\SADesktop                  512              0.5
  __X78B95_89_IW\__A8D9S1_42_ID       512              0.5
-------------------------------------------------------------
C:\kktools\dheapmon8.1\x86>


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:
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems\

It was set to:

%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

I changed it to:

%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


(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.

Links
http://blogs.msdn.com/ntdebugging/archive/2007/01/04/desktop-heap-overview.aspx

Tuesday, December 04, 2007 9:23:59 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -

Windows


Navigation
Archive
<October 2008>
SunMonTueWedThuFriSat
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2008
Paul Mrozowski / RCS Solutions, Inc.
Sign In
Statistics
Total Posts: 57
This Year: 32
This Month: 0
This Week: 0
Comments: 21
All Content © 2008, Paul Mrozowski / RCS Solutions, Inc.
DasBlog theme 'Business' created by Christoph De Baene (delarou)