From: Chris B. <chr...@gm...> - 2006-08-17 00:39:31
|
On 17/08/06, Chris Bainbridge <chr...@gm...> wrote: > The attached patch to current cvs fixes my memory problems. The > ode.World needs to keep track of all Joint, Body, Geom objects, since > dWorldDestroy removes the underlying objects (in the case of Geom the > body it links to is removed rather than the Geom itself, but Geom then > tries to unlink itself from the Body). Ok, it doesn't fix everything... to deal with non-deterministic destructor order pyode would have to know about every pointer between ode objects, and some are hidden and can't be easily changed through the API without knowing if both underlying objects are still valid (body->geom for example). So we would need to ensure that the underlying ODE objects are deconstructed in the right order, and deconstruction is delayed when we know that another python object that is still valid has an ode internal pointer to the to-be-destroyed object. Argh. It's probably easier to have an explicit cleanup function to be called at the end of a simulation that detaches all geoms, joints, and bodies, and then actually destroy the underlying objects in the usual pyrex destructor. |