Just Let It Flow

October 3, 2009

Desktop Heap Monitor for Windows Vista, Server 2008 and 7

Filed under: Code,Windows — adeyblue @ 8:49 pm

Please note, this page has been archived. Please see the main Airesoft Desktop Heap Monitor page for a tutorial video. Future updates will be posted there

  1. Introduction
  2. Preparation
  3. Installation
  4. Usage
  5. Uninstallation

Introduction

For those who don’t know, Desktop Heap Monitor is a debugging tool that displays the consumption of desktop heaps in the current session. Due to its reliance on undocumented internal structures, the increase of the default size of interactive desktop heaps, or maybe just because it’s not an efficient use of time, Microsoft has so far decided not to release an update to the tool to allow it to work on operating systems released after Server 2003. So as I was doing some work in this area, I’ve created an update to let it do just that.

Preparation

Download my updated package containing the original Microsoft tool and my modifications. When that’s done, extract the files and navigate explorer into the created directory.

If you’re on 64-bit Windows, you can skip to the next paragraph. If not, the first thing to do is go into the x86 directory, right-click the dheapinst.exe file, select the compatibility tab in the popup and turn on compatability mode for Windows Server 2003 (Service Pack 1). Now skip to the installation step.

64-bit users will have to disable driver signature enforcement to load the driver, since it is not digitally signed. You can achieve this by holding F8 during Windows boot and selecting the option from the list. Unfortunately, you’ll have to do this every boot you want to use this version of dheapmon since the setting isn’t persistent. If you have the means and want to sign the driver yourself, go ahead. The comments include a link that tells you how to do this with a test certificate.

Installation

The actual installation instructions are exactly the same as they are in the original help file (that’s dheapmon.chm), with one minor exception. Instead of invoking dheapinst.exe directly you must specify dheapinst.com or dheapinst only in order for correct initialization to take place. So to install, fire up an elevated (Administrator) command prompt and type/copy and paste the following:

dheapinst -y srv*http://msdl.microsoft.com/download/symbols

The command will pause for a bit while internal information is downloaded from Microsoft. With that, assuming no errors are reported, setup is complete. If you’re in an investigative mood, the previously mentioned help file will give you other options along with explanations, but that’s strictly optional.

Usage

Before a report can be generated, run “dheapmon -l” to ensure the driver is loaded. After this has succeeded, “dheapmon” itself will generate a simple report and “dheapmon -v” will give a more in-depth report.

Some improvements have been made over the original version. The tool now gives reports on all desktops present on the computer regardless of session, rather than just the current session. As it is not uncommon for desktops in different sessions to be similarly named, the session that the desktop belongs to is appended to the name, producing output like the following:

Image of dheapdmp sample output

Image of dheapdmp sample output

The current session ID is given in the banner so you can easily see which desktops you are interacting with, rather than the ones used by services and other system components.

Uninstallation

Removal is achieved by running “dheapinst -r” from an elevated command prompt or by selecting the Desktop Heap Monitor entry from the “Add or Remove programs” control panel.

21 Comments

  1. We’re trying to get dheapmon working for a Windows Server 2008 virtual machine. i tried using your package but i couldnt get it working. It spit back a Win32k.sys symbol load error… Have any ideas?

    Comment by James — March 2, 2010 @ 8:53 pm

  2. The usual way to fix this is to tell it to load the symbols from Microsoft’s server. This page outlines the options: http://support.microsoft.com/kb/914216. Leave off the ‘.exe’ or replace it with ‘.com’ when running dheapinst though, otherwise it may install successfully but it won’t work properly. If you’re still getting the error, then it could be because of a firewall, the server is down, the symbol file isn’t available, your administrator account doesn’t have write permission for the current directory, etc.

    If the system is a single processor machine you can also use dheapinst -f flag to force the install.

    Comment by adeyblue — March 3, 2010 @ 1:45 am

  3. Thanks for you information.

    No matter whether I use the original or your instructions and modules, the symbols are copied down but the driver never installs:
    dheapinst – Driver Installation error occured (124)

    Drivers are in place and I’ve tried dheapinst … and dheapinst.com …. Neither option provides anything other than the failure listed above. Very little comes back on a search other than your site.

    This is on 2008 R1 SP2 (dual processor pentium (older no-hyperthreading) machine so I can’t use the -f option; tried it and failed); however, this is a clustered server. We have specific needs to test a clustered application heap issue.

    Do you know of any SP issue with SP2 or cluster related problem with this tool?

    If you have time, any input or thoughts would be greatly appreciated.

    Thanks and take care.

    Comment by mkmcgregor — June 9, 2010 @ 6:06 pm

  4. I got the same driver installation error 124 on a multiprocessor machine running Windows XP SP3, but was finally able to successfully install the dheapmon V8.1 by following the hints from http://support.microsoft.com/kb/914216 :
    > set _NT_SYMBOL_PATH=symsrv*symsrv.dll*C:\Symbols*http://msdl.microsoft.com/download/symbols
    > dheapinst
    dheapinst – Desktop Heap Monitor installed successfully
    This will download the symbol file in a new dir c:\Symbols and load the symbol file from there.

    Comment by jbrueckel — June 11, 2010 @ 9:47 am

  5. see also this: http://www.eggheadcafe.com/software/aspnet/31483162/dheapinst–driver-instal.aspx

    Comment by jbrueckel — June 11, 2010 @ 9:59 am

  6. If you’ve been getting DHeapmon failed with error 5 or a BSOD, I’ve fixed these errors. They are incorporated into the update package linked above. If you downloaded the package prior to 24th September 2010, please redownload it to get the fixes.

    Comment by adeyblue — September 24, 2010 @ 2:55 am

  7. Hello,

    I used the testlimit utility (http://blogs.technet.com/b/markrussinovich/archive/2010/02/24/3315174.aspx?PageIndex=2#comments) to measure my free desktop heap with the parameters
    testlimit -u -i

    I still didn’t manage to run your version of dheapmon on my Vista SP2 x32, i’m getting the dheapinst – Driver Installation error occured (124)”. I followed the installation instructions and loaded windows with disabled driver checking.

    I’ll try on my Win Server 2008 and will let you know.

    My question is this: Do you know why is the testlimit utility able to use only 64MB of desktop heap? I increased the registry value from 12MB (default on Vista) to 150MB. I expected that testlimit will use 150MB. Is 64MB the maximum size of a Windows desktop?

    Thanks,
    Daniel

    Comment by Daniel Pavlic — December 6, 2010 @ 8:22 pm

  8. I managed to get heapmon working on Windows 7 – no problems, just had to disable driver signing check during boot.
    It solved my question – testlimit can use up only up to 64MB, and the real desktop size is showed by heapmon.

    Now, does anyone know is it possible/safe to disable driver signing check permanently on windows 7/2003/2008/Vista?

    I read on http://computertechnos.blogspot.com/2009/08/windows-2008-disabling-driver-signature.html that it is possible to disable it permanently without the need to set it up every time on boot by typing BCDEdit /Set LoadOptions DDISABLE_INTEGRITY_CHECKS in command prompt.

    Comment by Daniel Pavlic — December 7, 2010 @ 11:39 am

  9. This article was AWESOME. Was getting the error on Win7, but your simple instructions helped me resolve it. Thanks.

    jg

    Comment by tresstylez — March 17, 2011 @ 8:23 pm

  10. This is exactly what I needed! Thanks!

    Comment by Gordon Freeman — August 19, 2011 @ 10:52 am

  11. Hi thanks for the updated version. We are installing on Windows Server 2008 R2 and have run DHeapInst.com -y srv*http://msdl.microsoft.com/download/symbols which says “Desktop Heap Monitor installed successfully”. However when running dheapmon.exe -l we get the following error: DheapmonLoadDriver() was failed. Error (577). Is there any way to resolve this?

    Thanks

    Comment by Will — October 4, 2011 @ 10:42 am

  12. Absolutely incredible! I consider Dheapmon indispensible so I am especially grateful that you’ve created this 64 bit package.

    The only way it could be better is if the driver were signed. Is there any possibility of that happening?

    Comment by Syclone0044 — October 22, 2011 @ 6:41 pm

  13. Not really. Considering this is my only tool that’s not a proof of concept that requires it, supporting it to the tune of $99 a year isn’t really cost effective. You’re welcome to sign it yourself either legitimately or via a test certificate though.

    Comment by adeyblue — October 22, 2011 @ 9:02 pm

  14. “Hi thanks for the updated version. We are installing on Windows Server 2008 R2 and have run DHeapInst.com -y srv*http://msdl.microsoft.com/download/symbols which says “Desktop Heap Monitor installed successfully”. However when running dheapmon.exe -l we get the following error: DheapmonLoadDriver() was failed. Error (577). Is there any way to resolve this?”

    I got this exact same error. Win 2008 R2 64 bit. the dheapinst installed correctly, but the dheapmon load gets the error 577. No one has posted a solution to this.

    Comment by Jon — June 24, 2012 @ 5:58 am

  15. That error is because the driver file is not digitally signed. There are three otions available to allow it to be loaded:
    1. Sign the driver with a real digital certificate
    2. Disable Driver Signature Enforcement on the machine
    3. Enable test signing option on the machine, and install my certificate

    Option 1 is the easiest if you already have a personal or company digital certificate. Sign the file nomally and the error will go away

    Option 2 requires restarting the machine you’re installing on, holding F8 while Windows boots, and selecting the ‘Disable Driver Signature Enforcement’ option. The downside is that the setting doesn’t persist across reboots and must be done manually.

    Option 3 is sort of half way halfway between with the downside that it will add some “Test Mode” watermarks to the desktop (see here for more: http://msdn.microsoft.com/en-us/library/windows/ff553484(v=vs.85).aspx).
    To install, download this package (http://www.airesoft.co.uk/files/dheapdmp/signed.zip) and unzip it to the \dheapdmp\x64 directory. Uninstall any current driver using “dheapinst -r” then run the extracted “installsigned.cmd” file. Reboot the machine, then reinstall using “dheapinst” and off you go. You’ll have to do the “Installsigned.cmd then dheapinst” cycle on each
    machine you want to run it on, but then it’ll continue to work for as long as the tool is installed.

    I know they’re not perfect world options, but they are what they are.

    Comment by adeyblue — June 28, 2012 @ 2:20 am

  16. Thanks for this, I got it working on Windows 7.

    But on a 2008 R2 x64 VM, when I run the x64 dheapmon, I get:

    Desktop Heap Information Monitor Tool (Version 8.1.2925.0)
    Copyright (c) Microsoft Corporation. All rights reserved.
    DheapmonGetDesktopHeap() was failed. Error (5)

    Any ideas what’s going on ? There is mention of error 5 being fixed.

    Comment by kch — September 14, 2012 @ 4:50 pm

  17. I think that problem is fixed now. If anybody is encountering that with their current version (from this comments’ date anyway), should download the updated version, the problem fixed isn’t specific to Server 2008 R2 or to X64 computers in general.

    Comment by adeyblue — September 16, 2012 @ 12:57 am

  18. Hi,

    We have installed and loaded the driver on Windows 2008 R2 x64, and we are seeing the following error when trying to rnu dheapmon:

    Desktop Heap Information Monitor Tool (Version 8.1.2925.0)
    Copyright (c) Microsoft Corporation. All rights reserved.
    DheapmonGetDesktopHeap() was failed. Error (998)

    Any ideas ?

    Comment by kch — September 17, 2012 @ 1:39 pm

  19. Correction to my last comment – it is NOT R2 2008, just 2008.

    Comment by kch — September 17, 2012 @ 5:13 pm

  20. Aah, there’d been a subtle change in the data between Vista & 7 which caused it to blow up. Not exactly sure how that got through since I’d meant to have tested it on the various OS flavours last time somebody had a problem. Anyway, I’ve now done that (again), and it should be fine now, fingers/toes/knees/eyes crossed.

    If anyone was using it on 8, it no longer does (for now) since Windows internal data has changed again and I don’t have an RTM copy of 8 yet.
    D/L the update from: http://www.airesoft.co.uk/files/dheapdmp/dheapdmp.zip

    Comment by adeyblue — September 18, 2012 @ 4:11 am

  21. Wrote a script to automate the installation of Desktop Heap Monitor.
    To start the installation you will need:
    1. Unpack. Zip file.
    2. Enter the folder .\Dheapmon\x64 and run Install.bat.

    The script does the following:
    1. Installing the driver.
    2. Installs the Desktop Heap Monitor
    3. Installs the certificate in the store.
    4. Adds a path to dheapmon.exe in the system environment variables.
    5. Restarts the computer (optional).
    The script runs on Windows Server 2008 / r2 x64. For x86 need to fix the script.
    http://tech-note.ru/wp-content/uploads/2013/03/dheapdmp.zip

    Description is available here:
    http://tech-note.ru/?p=245

    Thank you!

    Comment by Dmitry — March 19, 2013 @ 2:29 pm

RSS feed for comments on this post. TrackBack URL

Sorry, the comment form is closed at this time.

Powered by WordPress