From: Chris B. <chr...@gm...> - 2005-08-01 08:34:53
|
Hi, the following code appears to leak Body and dict objects. Memprof is available from 'svn co http://svn.navi.cx/misc/trunk/python/memprof' (if anyone has a better way of profiling python memory usage let me know!). import ode import memprof sampler =3D memprof.Sampler() sampler.run() for i in range(1000): w =3D ode.World() body =3D ode.Body(w) # creating geom leads to 'dict' object leaks (_geom_c2py_lut ?) geom =3D ode.GeomCCylinder() # setBody leads to 'Body' object leaks geom.setBody(body) # no 'Body' leak if we set it back to None #geom.setBody(None) sampler.run() I've looked at the pyode code. It appears that nothing is ever removed from the global dictionary _geom_c2py_lut. Should this be done in geom __dealloc__ ? Similarly should geomobject __dealloc__ do 'del self.body'? Maybe it's not necessary and geoms are being removed, it would appear that they aren't from the profile, and yet what else other than the geom.body reference could be keeping Body objects alive? Thanks, Chris |