Improve USD plugin detection and memory error diagnostics#3050
Open
Ashutosh0x wants to merge 2 commits intogoogle-deepmind:mainfrom
Open
Improve USD plugin detection and memory error diagnostics#3050Ashutosh0x wants to merge 2 commits intogoogle-deepmind:mainfrom
Ashutosh0x wants to merge 2 commits intogoogle-deepmind:mainfrom
Conversation
- Fix redefined 'stat' error in MinGW (src/user/user_resource.cc) - Fix MinGW stack flag syntax in MujocoLinkOptions.cmake - Remove stack flags from Python modules to prevent Windows load crashes - Enable thread-safe localtime_s for MinGW (src/engine/engine_util_errmem.c) - Handle 0-sized mju_malloc on Windows to prevent crashes
- Fix USD resource discovery on Windows by searching both 'bin' and 'lib' directories - Correct plugInfo.json library paths for Windows installations - Include requested allocation size in 'Could not allocate memory' error messages - Add safety check for 0-sized memory requests on Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description: Improve USD Plugin Detection and Memory Robustness
This Pull Request introduces enhancements to MuJoCo's USD integration and improves memory allocation diagnostics, with a focus on cross-platform reliability (Windows/MinGW/macOS).
Changes
1. Robust USD Plugin Resource Discovery (#3004)
src/experimental/usd/utils.ccto search formujoco-usd-resourcesin both the current library directory and the siblinglibdirectory. This is essential for Windows where DLLs often sit in abinfolder while resources reside inlib.plugInfo.jsongeneration insrc/experimental/usd/CMakeLists.txtto correctly point to thebindirectory for shared libraries on Windows. This ensures that USD can actually load the plugins it registers.2. Enhanced Memory Error Diagnostics (#2992)
src/engine/engine_util_errmem.cto include the requested allocation size in the "Could not allocate memory" fatal error. This provides immediate clarity on whether a crash is due to system exhaustion or an invalid (e.g., massive) size request from program logic.mju_mallochandles 0-sized requests gracefully. On Windows,_aligned_malloc(0)returnsNULL, which was previously triggered a fatal "out of memory" error. We now ensure a minimum valid allocation to prevent these false-positive crashes.Verification
plugInfo.jsonpaths resolve correctly for standard Windows installation structures.<vector>header inutils.ccdoes not conflict with existing builds.These improvements make it much easier for Windows users to use the new USD features and provide better tools for debugging memory-related issues.