Skip to content

get_connections mem leak #230

Closed
Closed
@giampaolo

Description

From tiberius...@gmail.com on November 18, 2011 19:44:12

import psutil
import time
from pympler import muppy

def monitorConnections():

    proc_obj_iter = psutil.process_iter()    
    for proc_obj in proc_obj_iter:  
        conn = proc_obj.get_connections()
        del conn

while True:        
    monitorConnections()
    muppy.print_summary()        
    time.sleep(2)  

The function get_conenctions has mem leaks creating tuple references
and the mem is increased at every iteration.(after a while no ram remaining:)

script output:
                       types |   # objects |   total size
============================ | =========== | ============
                        dict |         979 |      2.28 MB
                         str |       19279 |      1.24 MB
is increasing ---->    tuple |        8050 |    615.80 KB
                        code |        2040 |    239.06 KB
                        type |         252 |    220.50 KB
          wrapper_descriptor |        1103 |     77.55 KB
  builtin_function_or_method |         894 |     55.88 KB
                        list |         297 |     39.97 KB
                         int |        1536 |     36.00 KB
                     weakref |         430 |     33.59 KB
           method_descriptor |         413 |     25.81 KB
           member_descriptor |         289 |     18.06 KB
         <class 'abc.ABCMeta |          19 |     16.63 KB
         function (__init__) |         116 |     12.69 KB
                         set |          57 |     12.47 KB

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

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions