Memory leak in Windows Page file when calling a shell command

I have an issue on our Windows 2003 x64 Build Server when invoking shell commands from a script. Each call causes a “memory leak” in the page file so it grows quite rapidly until it reaches the maximum and the machine stops working.

I can reproduce the problem very nicely by running a Perl script like

for ($count=1; $count<5000; $count++) { system "echo huhu"; }

It is independent of the scripting language as the same happens with Lua:

for i=1,5000 do os.execute("echo huhu") end

It’s also an issue when using PHP. (Their solution (uninstalling a secondary firewall) doesn’t apply since neither a firewall or virus Scanner are running on the machine.)

We can also reproduce the issue on other developer machines running Windows XP 64, but not on XP 32 Bit.

The guilty guy for the allocation is C:\WINDOWS\System32\svchost.exe -k netsvcs which runs all the basic Windows services.

Does anybody know the issue and how to resolve it?

Answer

To get a better idea about which process, assuming you know the PID, run tasklist /svc and see if you can better determine which service this is happening with. If, as I’m guessing, this is running under IIS, then it will probably show as W3SVC

Does this happen to you when running the Perl script from a command line, or triggered by IIS? If it’s the former, I’m not sure how that makes sense, because there shouldn’t be any services involved with that. If it’s the latter, can you describe your setup more fully?

Have you tried running anything like ProcessExplorer or Process Monitor, from the SysInternals team at MS? Very useful tools.

Attribution
Source : Link , Question Author : Community , Answer Author : mfinni

Leave a Comment