Modify user values in mujoco to allow users to provide cleanup functions to avoid memory leaks.
For the MJCF -> USD plugin, and I suspect other usecases for user values, it's necessary to give ownership of the object to Mujoco. However since they get type erased, we can't clean up the data automatically for the user. Instead this allows c++ clients to provide a cleanup function with their data. PiperOrigin-RevId: 756832010 Change-Id: I80b8e7822e1a0e399a0d19dcaa57ee69b3ccc16a
This commit is contained in:
committed by
Copybara-Service
parent
baf84265b8
commit
924ee3070a
@@ -4459,6 +4459,17 @@ Transform body into a frame.
|
||||
|
||||
Set user payload, overriding the existing value for the specified key if present.
|
||||
|
||||
.. _mjs_setUserValueWithCleanup:
|
||||
|
||||
`mjs_setUserValueWithCleanup <#mjs_setUserValueWithCleanup>`__
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mjs_setUserValueWithCleanup
|
||||
|
||||
Set user payload, overriding the existing value for the specified key if
|
||||
present. This version differs from mjs_setUserValue in that it takes a
|
||||
cleanup function that will be called when the user payload is deleted.
|
||||
|
||||
.. _mjs_getUserValue:
|
||||
|
||||
`mjs_getUserValue <#mjs_getUserValue>`__
|
||||
|
||||
Reference in New Issue
Block a user