From: Martin V. <vo...@na...> - 2007-05-28 13:02:34
|
Hello There seem to be a memory leak in PyODE due to undeleted geom objects. I found the problem while working on a simulator that need to create and delete many geom objects. I used the Heapy memory profiler (part of Guppy-PE) to determine the cause of the leak. I'm running python-2.4.2 and PyODE 1.2.0. The following program fills memory quickly: import ode while True: s = ode.Space() The cause is due to a internal global lookup dictionary for geom objects called _geom_c2py_lut. When a geometry object is created it is added to the global dictionary. This will prohibit the reference count to reach zero and the object will not be removed. I'm still quite new to Python and Pyrex and can unfortunately not contribute much to any solution. Currently I simply set ode._geom_c2py_lut = {} when deleting an instance of my simulator. The same could be achieved by placing a _geom_c2py_lut.clear() in CloseODE(). Neither is a solution. One would like the geom objects to remove themselves from the dictionary when deleted. Why is the dictionary not removed when I do a reload(ode)? /Martin |