Memory management when frequently deleting dynamicsWorld
Posted: Wed Nov 07, 2007 1:15 am
Hi,
quick question: for the kart racing game I am working on I am creating a new btDiscreteDynamics world for each race. I am currently having some problems with deleting a dynamics world (crashes somewhere in the destructor). For now I assume that I am doing something wrong and I will chase it for a while, but I am generally wondering about memory management: do I have to free all allocated objects (like btAxisSweep3, btSequentialImpulseConstraintSolver, rigid bodies, motion states for bodies, ...) myself? Or are any objects handled (esp. freed) internally?
When can I delete objects, e.g. btAxisSweep - immediately after the dynamics world was created (i.e. does bullet make a copy), or do I have to keep it till the end (i.e. delete it after deleting the world)?
Or would you generally recommend to have only one dynamics world, and just remove all btrigid objects for each new race?
Hope these questions are not too general.
Cheers,
Joerg
quick question: for the kart racing game I am working on I am creating a new btDiscreteDynamics world for each race. I am currently having some problems with deleting a dynamics world (crashes somewhere in the destructor). For now I assume that I am doing something wrong and I will chase it for a while, but I am generally wondering about memory management: do I have to free all allocated objects (like btAxisSweep3, btSequentialImpulseConstraintSolver, rigid bodies, motion states for bodies, ...) myself? Or are any objects handled (esp. freed) internally?
When can I delete objects, e.g. btAxisSweep - immediately after the dynamics world was created (i.e. does bullet make a copy), or do I have to keep it till the end (i.e. delete it after deleting the world)?
Or would you generally recommend to have only one dynamics world, and just remove all btrigid objects for each new race?
Hope these questions are not too general.
Cheers,
Joerg