﻿id,summary,reporter,owner,description,type,status,component,version,resolution,keywords,cc,guest,host
13817,Memory leak in python vboxapi,ali123,,"This is an issue with the python library in the sdk: {{{sdk/install/vboxapi/__init__.py}}}

If you create, then delete, a WEBSERVICE VirtualBoxManager object then it leaves 2 uncollectable objects in the garbage collector: vboxapi.VirtualBoxManager and ZSI.parse.ParsedSoap. The first is due to a circular reference, and the second due to a typo.

'''To replicate:'''
{{{
import gc
from vboxapi import VirtualBoxManager
creds = {'url': 'http://SERVER:18083', 'user': 'USERNAME', 'password': 'PASSWORD'}
manager = VirtualBoxManager('WEBSERVICE', creds)
del manager
gc.collect()
gc.garbage
}}}


This displays the uncollectable objects:

{{{[<vboxapi.VirtualBoxManager object at 0x0235DED0>, <ZSI.parse.ParsedSoap instance at 0x0413D7D8>]}}}

'''To workaround:'''
Perform the following instead of ""del manager"":
{{{
manager.platform.disconnect()
del manager.mgr
del manager
}}}


'''The circular reference issue:'''

{{{__init__.py}}} has a circular reference at the end of the {{{__init__}}} method of the VirtualBoxManager class (line 996):
{{{
    self.mgr = self;
}}}
The VirtualBoxManager class also defines a {{{__del__}}} method (line 998).

A circular reference and a {{{__del__}}} method mean that the object cannot be collected by the garbage collector (see https://docs.python.org/2/library/gc.html#gc.garbage).


'''The typo:'''

In file {{{__init__.py}}}, class PlatformWEBSERVICE, method deinit it calls disconnect(), where it should call self.disconnect() (line 878).

",defect,closed,other,VirtualBox 4.3.20,fixed,vboxapi python sdk,,all,Windows
