With 3.3.1, the following code:
prints:Code:import Ice import gc ic = Ice.initialize() ic.shutdown() ic.destroy() del ic reload(Ice) gc.collect() print "GLOBAL" print dir() print "LEFTOVER" for o in gc.get_objects(): if str(type(o)).find("Ice") > -1: print type(o)
Code:GLOBAL ['Ice', '__builtins__', '__doc__', '__file__', '__name__', 'gc'] LEFTOVER <class 'Ice.OperationMode'> <class 'Ice.OperationMode'> <class 'Ice.OperationMode'> <class 'Ice.EndpointSelectionType'> <class 'Ice.EndpointSelectionType'> <class 'Ice.CommunicatorI'>leaves 100 communicators, but only the 3 operation modes and the 2 endpoint selection types.Code:for x in range(100): ic = Ice.initialize() ic.shutdown() ic.destroy() del ic gc.collect()
However, if I add "del ic._impl" then garbage collection can reap the communicator:
prints:Code:import Ice import gc for x in range(100): ic = Ice.initialize() ic.shutdown() ic.destroy() del ic._impl # THIS LINE ADDED del ic gc.collect() print "GLOBAL" print dir() print "LEFTOVER" for o in gc.get_objects(): if str(type(o)).find("Ice") > -1: print type(o)
Cheers,Code:<class 'Ice.OperationMode'> <class 'Ice.OperationMode'> <class 'Ice.OperationMode'> <class 'Ice.EndpointSelectionType'> <class 'Ice.EndpointSelectionType'>
~josh

Reply With Quote