DebugDiag fix for Overflow at Line 2397

DebugDiag is a free debugging tool which you can get from Microsoft. It's for debugging crashes, hangs and memory leaks.

If you've tried to use DebugDiag 1.1 (latest as of March 2009) to debug a memory leak then you may have run into this error:

Script Name Status Error Code Error Source Error Description Source Line
MemoryAnalysis.asp Failed 0x800a0006 Microsoft VBScript runtime error Overflow Line 2397, Column 0

DebugDiag error screenshot

A fix for that error is available below.

Installing the fix

  1. Download (PGP sig) and extract it to a temp folder.

  2. Go to C:\Program Files\DebugDiag\Scripts\Inc (that'll be Program Files (x86) on 64-bit Windows) and verify that your current HeapFunctions.asp is the same as HeapFunctions_orig.asp from the zip.

  3. If the old files are not the same then don't continue. You could be using a newer version of DebugDiag which includes a similar fix and copying my file over yours could break something!

  4. Assuming the old files are the same, copy the new HeapFunctions.asp from the zip over the one in Program Files and you're done.

Your existing DebugDiag dump files should be fine. You just need to select them and re-generate the analysis of them.

Details of the fix

For each memory heap in the target process DebugDiag reports two percentages: Committed / Reserved and Uncommitted / Reserved. If the Reserved value is zero -- presumably due to a heap which was created but never used -- then those calculations trigger a divide-by-zero error which VBScript reports as an overflow.

This was easy to fix because the calculations are done in some VBScript within one of the .ASP text files that are part of DebugDiag. While the error message says the problem is in on line 2397 of MemoryAnalysis.asp it's actually on line 187 of HeapFunctions.asp, which MemoryAnalysis.asp includes. (Neither file even has a line 2397; they're both much shorter. The parser appears to treat included files as if they were literally part of the top-level file, reporting all errors as coming from the top-level file and accumulating line numbers as each file is included.)

Here's a screenshot showing my changes and the source of the divide-by-zero errors:

Changes and errors in the ASP file

(The tool in the screenshot is the excellent Beyond Compare.)

Gratuitous plug

Check out Directory Opus, IMO the best file manager for Windows. That goes double if you're using Vista.

Directory Opus