by Rocko Bonaparte » Sun Oct 16, 2011 8:35 am
I think the leaks are in the wrapper. I will soon try to add some changes into the destructor that will make them go away.
In rigidbody.cpp, a motion state is created that I don't see getting explicitly freed. Valgrind was getting caught up on that.
In the IGImpactMeshShape source file igimpactmeshshape.cpp, it's creating a btImpactMeshShape, but it doesn't appear to get freed. This is more interesting to me because I think I see sphere shapes I'm using elsewhere that don't explicitly free their underlaying stuff, yet I don't get any complaints on them. So I wonder if the free policy is different for a bullet impact mesh shape than a sphere mesh shape. The physics object that is based off of the impact mesh is getting removed, and I do see in the logging that it is considered to have been deleted.
Outside of this it looks like my bullet world object wasn't getting freed, and a whole new can of worms opened up after I deleted it in unrelated code. I have to clear that out first, then I will worry about the motion state stuff.
Cobra, I added ghost objects to your code, and if I find I've reduced some leaks, I'd like to send a patch to you. The ghost objects are particularly important to me for game logic stuff.
Edit: Deleting the motion state in the destructor did take care of the leak and it looks like nothing has yet exploded as a consequence of doing this. I think a lot of the other stuff I'm seeing is from bullet. I think it replaced malloc() with its own version, so valgrind gets completely messed up with it.