[ODE] Memory Leak

Christopher Fraser cfraz89 at exemail.com.au
Thu Dec 22 17:24:00 MST 2005

I am using ODE through Crystal Space, to simulate a vehicle.
It all works fine and dandy using hinge2 joints to connect the wheels to the
car, however there is some weird behaviour going on with the memory usage.
It seems that when the joints are required to use a force to keep the wheels
at their stops, my game starts to leak memory. If the car goes straight
forward after the game starts, there is no leak. However, as soon as a
sideways force is put on the car, a memory leak starts.
The memory leak only happens if i set stops for the joints.
This is the code which sets the stops in CS:
void csODEJoint::BuildHinge2 (const csVector3 &axis1, float min1, float max1,
                              const csVector3 &axis2, float min2, float max2)
  dJointSetHinge2Axis1 (jointID, axis1.x, axis1.y, axis1.z);
  dJointSetHinge2Axis2 (jointID, axis2.x, axis2.y, axis2.z);
  if (max1 > min1)
    dJointSetHinge2Param (jointID, dParamLoStop, min1);
    dJointSetHinge2Param (jointID, dParamHiStop, max1);
    dJointSetHinge2Param (jointID, dParamLoStop, -dInfinity);
    dJointSetHinge2Param (jointID, dParamHiStop, dInfinity);
  if (max2 > min2)
    dJointSetHinge2Param (jointID, dParamLoStop2, min2);
    dJointSetHinge2Param (jointID, dParamHiStop2, max2);
    dJointSetHinge2Param (jointID, dParamLoStop2, -dInfinity);
    dJointSetHinge2Param (jointID, dParamHiStop2, dInfinity);

I set the lo and stops to 0 for each joint.
The crystal space people and i are fairly sure it is an ode issue.
I have tried it with a few versions of ode cvs.

More information about the ODE mailing list