windows mem leak

Peter Hansen peter at engcorp.com
Sun Jan 9 19:59:12 CET 2005


Bob Smith wrote:
> Peter Hansen wrote:
[snip details of Bob's platform]
> WinXP Home, Service Pack 2, AMD 1400MHz proc, 256MB Ram

That's not really much RAM for a WinXP box.  Do you have
lots of physical memory available before running?

>> (I presume you're using a version of nmap that's compiled
>> for Windows XP then?
> Yes, I am.
> 
>> It's certainly not standard.
> That's a matter of opinion. Nmap works fine on the WinXP machine.

Perhaps my use of "standard" was obscure, since it's definitely
not a matter of opinion, the way I intended it.  What I meant
was "nmap is certainly not included in the standard Win XP
distribution".

>> How have
>> you proven that it is not *that* program which is at fault?)
> 
> I have not. All I know is that on WinXP, the program uses 100% CPU at 
> times and consumes more Ram than is available (the page file grows to 
> 700 or 800MB). It runs OK for a few hours and then produces a 'not 
> enough resources' error. 

Is it certain that this memory is being consumed by the Python
process?  I could imagine, for example, there being dozens of
new processes spawned with os.system.  Does the Task Manager
back up the theory that this "python.exe" instance is the one
causing the trouble?  Presumably it should be clear even before
the machine grows unusable.  Note that you can select which
columns are shown in the "Processes" tab of the Task Manager
window, to get more detail on a given process.  (The Performance
Monitor found under Control Panel, Administrative Tools can
be even more useful and precise.)


> And, the machine is generally unuserable. On 
> Linux, it has no impact whatsoever on resources. Granted, the Linux 
> machine is much more robust, but one wouldn't expect this great a 
> difference. I can rewrite it so that it's pure Pyhton (no calling nmap) 
> if you think that would be a good idea. Perhaps that would at least 
> remove nmap from the equation.

A simpler test might be to change the nmap call to something
guaranteed benign, like a call to "dir", and try with that.
That's assuming you don't actually need the output of nmap
to reproduce the problem, which of course isn't sure.  Still,
it would be an easy test, and might show a problem elsewhere.

> I can run it if you like and take a screen shot of the error. You'll 
> have to give me a few hours though ;)

I trust that you are getting the error dialog you say you are. :-)
I have a feeling that the message by itself helps little, however,
and that you'll have to try a few different approaches to observe
the problem as it grows, via Task Manager or another tool, rather
than just trying to guess what happened after the machine is
already effective kaput.

-Peter



More information about the Python-list mailing list