Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_memory_info() Leaks Handles #166

Closed
giampaolo opened this issue May 23, 2014 · 11 comments
Closed

get_memory_info() Leaks Handles #166

giampaolo opened this issue May 23, 2014 · 11 comments

Comments

@giampaolo
Copy link
Owner

From [email protected] on May 26, 2011 19:30:57

What steps will reproduce the problem?  
1. Run get_memory_info() in a loop 

What is the expected output?  


What do you see instead?  
Handles should not increase. 

What version of psutil are you using? What Python version?  
Python 2.5
psutil 0.2.1 (From download package) 

On what operating system? Is it 32bit or 64bit version?  
Windows XP 32-bit 

Please provide any additional information below.  
It seems as though the opened handle in _psutil_mswindows.c:465 never gets 
closed after being used. In other parts of the source the appropriate 
CloseHandle function destroys the handle returned from OpenProcess. In my 
script this causes a lot of problems due to the constant access to 
get_memory_info() and run time.

Original issue: http://code.google.com/p/psutil/issues/detail?id=166

@giampaolo
Copy link
Owner Author

From [email protected] on May 26, 2011 10:42:00

Thanks for the issue report, get_memory_info() was indeed not closing the 
handles opened. Fixed in r977

Status: FixedInSVN

@giampaolo
Copy link
Owner Author

From [email protected] on May 26, 2011 10:42:15

Labels: OpSys-Windows

@giampaolo
Copy link
Owner Author

From [email protected] on May 26, 2011 10:42:53

Labels: Milestone-0.2.2

@giampaolo
Copy link
Owner Author

From g.rodola on May 26, 2011 11:55:01

I noticed there are at least a couple more places where CloseHandle() should be called.
I think it would be good to have a test for this (it's not the first report).
Maybe it would make sense to expose a method to determine opened handles on Windows.
Not sure whether public or private; is it something that might be desirable?

Status: ReOpened

@giampaolo
Copy link
Owner Author

From [email protected] on May 26, 2011 11:57:42

Fine with me if we add a test for it, but I thought we already had memory leak 
testing that should have caught these?

@giampaolo
Copy link
Owner Author

From [email protected] on May 27, 2011 01:40:30

Handles do not appear as memory usage for a process.

@giampaolo
Copy link
Owner Author

From g.rodola on May 31, 2011 05:13:10

See r979 and r980 .
It seems we are leaking handles somewhere in get_process_ppid().

Status: Started

@giampaolo
Copy link
Owner Author

From g.rodola on June 27, 2011 10:52:41

Labels: Milestone-0.3.0

@giampaolo
Copy link
Owner Author

From g.rodola on June 30, 2011 03:22:42

The failures were false positives.
Closing this out as fixed.

Status: FixedInSVN

@giampaolo
Copy link
Owner Author

From g.rodola on July 08, 2011 12:07:35

Status: Fixed

@giampaolo
Copy link
Owner Author

From g.rodola on March 02, 2013 04:00:36

Updated csets after the SVN -> Mercurial migration: r977 == revision 
401430e49618 r979 == revision 8ecb886ceab7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant