Page 1 of 1

Issues with multi-threading and compound shapes

Posted: Thu Oct 28, 2021 6:18 pm
by desaic
I'm working on a demo with both compound shapes and multi-threading. I observed the number of contact manifolds keep increasing overtime (m_manifoldsPtr in btCollisionDispatcherMt), this eventually slows down the simulation. I did a few experiments and here is what I found:

When using both multi-threading and compound shapes, the function btCollisionDispatcherMt::releaseManifold will be called, but the variable m_batchUpdating will always be true during the simulation. Then I found the compoundcompound collision algorithm will attempt to deallocate collision algorithms while it is processing collisons. When the collision algorithm deallocates, it will release the contact manifold and in then calls the btCollisionDispatcherMt::releaseManifold. But because this funciton is called while the compound algorithm is processing collisions, the member m_batchUpdating will always be true, because the collision is processed in the parallel for after m_batchUpdating is set to true. As a result, this section of the code will never get run during the simulation and m_manifoldsPtr will keep increasing.

Is this a potential bug, or I'm missing something?

Re: Issues with multi-threading and compound shapes

Posted: Mon Dec 06, 2021 5:32 am
by KKlouzal
I seem to be having this same issue however it's only happening on 1 of my 5 test machines.