JV-ODE Physics Thread 9

Blitz3D Forums/Blitz3D Userlibs/JV-ODE Physics Thread 9

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

dGeomTransformSetCleanup performs an automatic cleanup of the geoms when the transform is deleted. It doesn't remove the collision data though leading to potential memory leaks. The reason it's causing the MAV would be due to deleting the geoms manually, then ODE tries to do it too and they're not there anymore. Danny highlighted a problem with this function in JV-ODE Physics Thread 8, about a third of the way down. Have a look at it if you can.

The solution to cleanup transform geoms and their data correctly is as follows...

First you -must- set the transform cleanup mode to zero (disable) for this to work correctly...

dGeomTransformSetCleanup TransformGeom,0
Next, when you want to destroy the transform and parent geoms, you should do it in the following order...

dGeomDestroy GeomObject
dGeomDestroy TransformGeom
dGeomDestroy Geom
dBodyDestroy Body
Now everything is cleaned up correctly and there's no memory leak.


I'd recommend switching over to Geom Offsets instead of Geom Transforms, as they're much easier to manage.

If you want to delete entire objects, it's best to delete them individually in the reverse order that they were created...

Joint(s) > Geom(s) > Body > Type