Skip Menu |

This queue is for tickets about the Win32-Process-Info CPAN distribution.

Report information
The Basics
Id: 11871
Status: resolved
Priority: 0/
Queue: Win32-Process-Info

People
Owner: wyant [...] cpan.org
Requestors: slloyd [...] timequest.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.004
Fixed in: (no value)



Subject: Memory leak
There is a memory leak with the following (watch the handle count of perl.exe when this is run). Version: Win32-Process-Info-1.004 OS: Windows XP SP2 Perl Version: v5.8.4 built for MSWin32-x86-multi-thread <code> #!perl use strict; use Win32::Process::Info; my $variant='NT'; while(1){ my $pi = Win32::Process::Info->new (undef, $variant); my @procs = $pi->GetProcInfo(); undef $pi; my $pcnt=@procs; print "$pcnt processes running\n"; sleep(2); } </code>
The problem here turned out to be twofold: 1) Win32::Process::Info::NT can get more information on the processes if it asserts seDebugPriv. But it stupidly asserts it every time an object is instantiated, when it really only needs to assert it once for the process running Perl. 2) Win32API::Registry::AllowPriv () gets a new security token every time it is called, but does not close/deallocate/whatever when it is done. So the security tokens pile up. I have fixed (1), so that the privilege is asserted when the first object gets instantiated, but not thereafter. I have not attempted to contact the author of Win32API::Registry, since the version of Win32API::Registry that comes with ActivePerl (and libwin32) is not the current one anyway. The fix should be available on CPAN shortly, and on ActiveState's PPM repository as soon as they get around to doing their update.