1

I'm hunting of a memory pool leak using poolmon. In the KB article, they explain how to capture the output manually using cut&paste. Isn't there a way to automate this?

Since the tool doesn't seem to support it, my idea was to run two command prompts (one for paged and one for nonpaged pools), and use a tool to make an automatic screenshot. If this was possible, which tool would you suggest? Is there a tool that can cut the text out of a command prompt without manual intervention?

Aaron Digulla
  • 954
  • 1
  • 13
  • 24

2 Answers2

5

In version 5.2.3790.0 (from the W2K3 RTM support tools) you can specify a "snapshot" file:

poolmon -n filename.log

It will write both the paged and non-paged pool entries to this file.

I'd use scheduled tasks to run the following on a recurring basis:

@echo off
SET POOLMON="C:\Program Files\Support Tools\Poolmon.exe"
SET OUTDIR=C:\WINDOWS\TEMP

SET YEAR=%DATE:~10,4%
SET MONTH=%DATE:~4,2%
SET DAY=%DATE:~7,2%
SET HOUR=%TIME:~0,2%
IF /I %HOUR% LEQ 9 SET HOUR=0%HOUR:~1,1%
SET MINUTE=%TIME:~3,2%
SET SECOND=%TIME:~6,2%
SET ISODATE=%YEAR%-%MONTH%-%DAY%_%HOUR%-%MINUTE%-%SECOND%

%POOLMON% -n %OUTDIR%\poolmon.%ISODATE%.log

Set POOLMON to point to the path of Poolmon.exe and OUTDIR to point to whatever directory you want output written to and you'll get output files of the format:

poolmon.YYYY-MM-DD_HH-MM-SS.log

Throw that script into a scheduled task and you're in business.

Evan Anderson
  • 141,071
  • 19
  • 191
  • 328
  • I hope this version also runs on WinXP. I'll give it a try and let you know. – Aaron Digulla Jul 28 '09 at 14:37
  • Oh, and the date didn't work for me: In the German version, the format is 31.08.2009, so I had to replace the first three assignments with YEAR=%DATE:~6,4% MONTH=%DATE:~3,2% DAY=%DATE:~0,2% – Aaron Digulla Aug 07 '09 at 09:38
  • Good catch. I always forget that your version of Windows' default regional options affect the order of the DATE variable. – Evan Anderson Aug 07 '09 at 11:54
0
Rem You need sleep.exe and poolmon to run.
echo off
C:
cd \
MD Poolmon-log
cd poolmon-log
explorer c:\poolmon-log
SET POOLMON="Poolmon.exe"
SET OUTDIR=C:\poolmon-log\
SET YEAR=%DATE:~8,4%
SET MONTH=%DATE:~3,2%
SET DAY=%DATE:~0,2%
SET HOUR=%TIME:~0,2%
IF /I %HOUR% LEQ 9 SET HOUR=0%HOUR:~1,1%
SET MINUTE=%TIME:~3,2%
SET SECOND=%TIME:~6,2%
SET ISODATE=%DAY%-%MONTH%-%Year%_%HOUR%-%MINUTE%-%SECOND%
:Top1
%POOLMON% /p /p /b -n %OUTDIR%poolmon-%ISODATE%.log
sleep 3600
goto top1
pause

The above works in Ireland. Explorer will auto open the folder for viewing. Logs are dumped every 30min.