CollisionConfiguration?

sandeep_slash
Posts: 48
Joined: Thu Jul 10, 2008 6:36 pm

CollisionConfiguration?

Post by sandeep_slash »

Are we supposed to use btDefaultCollisionConfiguration for X360? Or is there a special CollisionConfiguration for this platform?

Cause I think I'm already running out of memory. It crashes (in btPoolAllocator) while allocating memory for CollisionConfiguration.

Sandeep.
sandeep_slash
Posts: 48
Joined: Thu Jul 10, 2008 6:36 pm

Re: CollisionConfiguration?

Post by sandeep_slash »

It crashes here: (in btdefaultcollisionconfiguration.cpp)

m_persistentManifoldPool = new (mem) btPoolAllocator(sizeof btPersistentManifold), constructionInfo.m_defaultMaxPersistentManifoldPoolSize);
sandeep_slash
Posts: 48
Joined: Thu Jul 10, 2008 6:36 pm

Re: CollisionConfiguration?

Post by sandeep_slash »

Can someone help me plzzzz??? I'm trying to run my code on X360 platform.

This is what I've as the first line in Init()== > "m_pCollisionConfiguration = new btDefaultCollisionConfiguration();"

In btDefaultCollisionConfiguration ctor, it crashes here
"m_persistentManifoldPool = new (mem) btPoolAllocator(sizeof(btPersistentManifold),constructionInfo.m_defaultMaxPersistentManifoldPoolSize);"

I looked at the btPoolAllocator ctor

m_pool = (unsigned char*) btAlignedAlloc( static_cast<unsigned int>(m_elemSize*m_maxElements),16);

m_pool was NULL after this statement.......

Thanks in advance....
Julian Spillane
Posts: 9
Joined: Tue Aug 12, 2008 9:15 pm

Re: CollisionConfiguration?

Post by Julian Spillane »

I think, by default, the DefaultCollisionConfiguration class eats up about 5 MB on initialization. We're developing on the Wii, and found that the 5 MB hit was a bit too high.

They key values you need to play with reside in the btDefaultCollisionConfiguration.h file in the constructor of btDefaultCollisionConstructionInfo:

btDefaultCollisionConstructionInfo()
:m_stackAlloc(0),
m_persistentManifoldPool(0),
m_collisionAlgorithmPool(0),
m_defaultMaxPersistentManifoldPoolSize(512),
m_defaultMaxCollisionAlgorithmPoolSize(512),
m_defaultStackAllocatorSize(1024*1024*5)

The highlighted line is the stack allocator size, which (as far as I can tell) is a large pool allocated beforehand to limit the number of dynamic memory allocs/dealloc during runtime (which can cripple systems that don't have any virtual memory such as the Wii, Xbox360, PS3, etc.).

For your purposes, especially if you don't make heavy use of concave shapes, you can easily reduce that value down to something more reasonable for your uses.

I can't give you a number without knowing more about the project and your other memory uses.

I hope this helps!

Best,
Julian