cobra wrote:Hi Rocko,
You are correct; you're making the memory leaks yourself.
Use this function to remove a collision object (both softbody and rigidbody):
- cpp Code: Select all
void irrBulletWorld::removeCollisionObject(ICollisionObject* const obj, bool deleteObject)
Never call delete on a pointer provided by irrBullet except the irrBulletWorld pointer.
Is there anything else to it? I have rerun valgrind since then, seeing that the freeing code was run, and it still purports to be leaking. The leak origin is when I allocate the RigidBody, so I believe the remove is incomplete. That being said, if I do a delete after the remove, I get a double free. So I am very perplexed. I have seen the program walk through the code that calls removeCollisionObject so I figured I was okay.