I am new to bullet and I thank you for your hard work, it's exactly what I needed !
But I have a problem when using multithreaded physics...
I get very important memory leaks just by initializing the threads.
Here is the code :
Code: Select all
mOutstandingTasks = 8;
mCollisionConfiguration = new btDefaultCollisionConfiguration();
mThreadSupportCollision = new Win32ThreadSupport(Win32ThreadSupport::Win32ThreadConstructionInfo(
"collision",
processCollisionTask,
createCollisionLocalStoreMemory,
mOutstandingTasks));
mDispatcher = new SpuGatheringCollisionDispatcher(mThreadSupportCollision,mOutstandingTasks,mCollisionConfiguration);
btVector3 worldAabbMin(-10000,-10000,-10000);
btVector3 worldAabbMax(10000,10000,10000);
mBroadphase = new btAxisSweep3(worldAabbMin,worldAabbMax,mProxies);
mThreadSupportSolver = new Win32ThreadSupport(Win32ThreadSupport::Win32ThreadConstructionInfo(
"solver",
processSolverTask,
createSolverLocalStoreMemory,
mOutstandingTasks));
// The actual physics solver
mSolver = new btParallelSequentialImpulseSolver(mThreadSupportSolver,mOutstandingTasks);
// The world.
mDynamicsWorld = new btDiscreteDynamicsWorld(mDispatcher,mBroadphase,mSolver,mCollisionConfiguration);
mDynamicsWorld->getSolverInfo().m_numIterations = 4;
mDynamicsWorld->getSolverInfo().m_solverMode = SOLVER_SIMD+SOLVER_USE_WARMSTARTING;
mDynamicsWorld->getDispatchInfo().m_enableSPU = true;
mDynamicsWorld->setGravity(btVector3(0,-40,0));
Code: Select all
delete mDynamicsWorld;
delete mSolver;
delete mThreadSupportSolver;
delete mBroadphase;
delete mDispatcher;
delete mThreadSupportCollision;
delete mCollisionConfiguration;
Code: Select all
{253} normal block at 0x0606F548, 161763 bytes long.
Data: < H > CD CD CD CD 48 F5 06 06 CD CD CD CD CD CD CD CD
{251} normal block at 0x06047AD8, 161763 bytes long.
Data: < z > CD CD CD CD D8 7A 04 06 CD CD CD CD CD CD CD CD
{249} normal block at 0x06020068, 161763 bytes long.
Data: < h > CD CD CD CD 68 00 02 06 CD CD CD CD CD CD CD CD
{247} normal block at 0x04F53730, 161763 bytes long.
Data: < 07 > CD CD CD CD CD CD CD CD CD CD CD CD 30 37 F5 04
{245} normal block at 0x04F2BCC0, 161763 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD C0 BC F2 04
{243} normal block at 0x04F04250, 161763 bytes long.
Data: < PB > CD CD CD CD CD CD CD CD CD CD CD CD 50 42 F0 04
{241} normal block at 0x04EDC7E0, 161763 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD E0 C7 ED 04
{238} normal block at 0x04EB4FC0, 161763 bytes long.
Data: < O > CD CD CD CD CD CD CD CD CD CD CD CD C0 4F EB 04
{220} normal block at 0x04EAF7A8, 21408 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{219} normal block at 0x04EAA3C8, 21408 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{217} normal block at 0x04EA4FE8, 21408 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{216} normal block at 0x04E9FC08, 21408 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{214} normal block at 0x04E9A828, 21408 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{212} normal block at 0x04E95448, 21408 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{209} normal block at 0x04E90068, 21408 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{208} normal block at 0x00977E50, 21408 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Did I forget something ?
Thanks !