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:
Kyle Bayes
2023-03-18 13:03:11 -07:00
committed by Copybara-Service
parent fae5e822c0
commit 8696247f9d
17 changed files with 103 additions and 48 deletions
+10 -1
View File
@@ -1187,7 +1187,16 @@ mj_stackAlloc
.. mujoco-include:: mj_stackAlloc
Allocate array of specified size on :ref:`mjData` stack. Call mju_error on stack overflow.
Allocate array of mjtNums on :ref:`mjData` stack. Call mju_error on stack overflow.
.. _mj_stackAllocInt:
mj_stackAllocInt
~~~~~~~~~~~~~~~~
.. mujoco-include:: mj_stackAllocInt
Allocate array of ints on :ref:`mjData` stack. Call mju_error on stack overflow.
.. _mj_deleteData:
+2
View File
@@ -48,6 +48,8 @@ General
- Modified :ref:`mju_error` and :ref:`mju_warning` to be variadic functions (support for printf-like arguments). The
functions :ref:`mju_error_i`, :ref:`mju_error_s`, :ref:`mju_warning_i`, and :ref:`mju_warning_s` are now deprecated.
- Implemented a performant ``mju_sqrMatTDSparse`` function that doesn't require dense memory allocation.
- Added ``mj_stackAllocInt`` to get correct size for allocating ints on mjData stack. Reducing stack memory usage
by 10% - 15%.
Python bindings
+1
View File
@@ -1873,6 +1873,7 @@ void mj_resetData(const mjModel* m, mjData* d);
void mj_resetDataDebug(const mjModel* m, mjData* d, unsigned char debug_value);
void mj_resetDataKeyframe(const mjModel* m, mjData* d, int key);
mjtNum* mj_stackAlloc(mjData* d, int size);
int* mj_stackAllocInt(mjData* d, int size);
void mj_deleteData(mjData* d);
void mj_resetCallbacks(void);
void mj_setConst(mjModel* m, mjData* d);