Add mj_stackAllocInt to get correct size for allocating ints on mjData stack. Reducing stack memory usage by 10% - 15%.
PiperOrigin-RevId: 517672195 Change-Id: Ie14e6c9c99e8b9e1c5d3686b77631f2df0651c67
This commit is contained in:
committed by
Copybara-Service
parent
fae5e822c0
commit
8696247f9d
@@ -388,8 +388,9 @@ void mj_collision(const mjModel* m, mjData* d) {
|
||||
// dynamic only or merge; apply exclude
|
||||
else {
|
||||
// call broadphase collision detector
|
||||
broadphasepair = (int*)mj_stackAlloc(d, (m->nbody*(m->nbody-1))/2);
|
||||
nbodypair = mj_broadphase(m, d, broadphasepair, (m->nbody*(m->nbody-1))/2);
|
||||
int npairs = (m->nbody*(m->nbody - 1))/2;
|
||||
broadphasepair = mj_stackAllocInt(d, npairs);
|
||||
nbodypair = mj_broadphase(m, d, broadphasepair, npairs);
|
||||
unsigned int last_signature = -1;
|
||||
|
||||
// loop over body pairs (broadphase or all)
|
||||
|
||||
Reference in New Issue
Block a user