I have been playing around with the new version of Bullet physics and hooked a debug allocator. I have seen that the btPoolAllocator allocated more than 40 megs of memory at startup (I haven't done anything with the world; barely created and destroyed the world).
Is there a reason for such a big pool ? it's for a pool of 65 000 btPersistentManifold, which are quite big.
On an x64 system, the size of the pool becomes 50 megs.
Moreover, it is possible to save 2 megs in this pool by reordering the fields of the btManifoldPoint structure and by putting the biggest fields first, so that there is no space lost due to alignment.
the current order is
Code: Select all
btVector3 m_localPointA;
btVector3 m_localPointB;
btVector3 m_positionWorldOnB;
///m_positionWorldOnA is redundant information, see getPositionWorldOnA(), but for clarity
btVector3 m_positionWorldOnA;
btVector3 m_normalWorldOnB;
btScalar m_distance1;
btScalar m_combinedFriction;
btScalar m_combinedRestitution;
//BP mod, store contact triangles.
int m_partId0;
int m_partId1;
int m_index0;
int m_index1;
mutable void* m_userPersistentData;
btScalar m_appliedImpulse;
bool m_lateralFrictionInitialized;
btScalar m_appliedImpulseLateral1;
btScalar m_appliedImpulseLateral2;
int m_lifeTime;//lifetime of the contactpoint in frames
btVector3 m_lateralFrictionDir1;
btVector3 m_lateralFrictionDir2;
Code: Select all
btVector3 m_localPointA;
btVector3 m_localPointB;
btVector3 m_positionWorldOnB;
///m_positionWorldOnA is redundant information, see getPositionWorldOnA(), but for clarity
btVector3 m_positionWorldOnA;
btVector3 m_normalWorldOnB;
btVector3 m_lateralFrictionDir1;
btVector3 m_lateralFrictionDir2;
mutable void* m_userPersistentData;
btScalar m_distance1;
btScalar m_combinedFriction;
btScalar m_combinedRestitution;
btScalar m_appliedImpulse;
btScalar m_appliedImpulseLateral1;
btScalar m_appliedImpulseLateral2;
int m_lifeTime;//lifetime of the contactpoint in frames
//BP mod, store contact triangles.
int m_partId0;
int m_partId1;
int m_index0;
int m_index1;
bool m_lateralFrictionInitialized;
On the bright side, thanks for the clean clean-up; a world leaves no memory when you destroy it. I am of the few people that want a program to have released everything at shut down and it's great to see no memory leak =) (which shows you are keeping good track of the usage of memory).
/n