Analysis Tool: Bad Allocation Error (MATLAB API)
Posted: Mon Oct 03, 2022 10:26 am
Hi All,
I am using the OpenSim (V4.3) API with MATLAB (R2021a) to batch process subject data through the Scaling, IK, ID, and Analysis Tools. I am currently able to scale a base model and run IK and ID on multiple trials for multiple subjects without issue. However, when I incorporate the Analysis Tool (to obtain model COM position) into the workflow I receive the following, seemingly random, bad allocation error (on some occasions I will instead get a fatal error, forcing MATLAB to close).
The error generally seems to become an issue when I attempt to process >7 subjects (all with roughly five 15-second running trials). Stepping through my Analysis Tool code (attached in the zip file), the error occurs when I attempt to run the tool (analysis.run()). Listed below are the steps I've taken to resolve the issue, but so far none have worked. I've also attached sample input my analysis function uses to generate COM position, while this won't replicate the error, it hopefully provides a bit more context, or hopefully someone notices something I missed. Any and all suggestions would be immensely appreciated. Thank you!!
Bad Allocation Error Troubleshooting:
1) When the error was thrown for a particular subject, reprocessed that subject individually with no issues.
2) Tried different datasets (and a dataset that only included subjects that threw no error during batch processing) and still ran into the error.
3) Upgraded my machine's memory + storage (now 4 processors, 16GB Ram, 134GB Hard drive) and still get the error.
4) Clear and close everything at the end of the analysis function--still get the error.
5) A previous forum post mentioned this issue was resolved by clearing out old setup files and results from folders: this unfortunately did not resolve the issue either.
I am using the OpenSim (V4.3) API with MATLAB (R2021a) to batch process subject data through the Scaling, IK, ID, and Analysis Tools. I am currently able to scale a base model and run IK and ID on multiple trials for multiple subjects without issue. However, when I incorporate the Analysis Tool (to obtain model COM position) into the workflow I receive the following, seemingly random, bad allocation error (on some occasions I will instead get a fatal error, forcing MATLAB to close).
The error generally seems to become an issue when I attempt to process >7 subjects (all with roughly five 15-second running trials). Stepping through my Analysis Tool code (attached in the zip file), the error occurs when I attempt to run the tool (analysis.run()). Listed below are the steps I've taken to resolve the issue, but so far none have worked. I've also attached sample input my analysis function uses to generate COM position, while this won't replicate the error, it hopefully provides a bit more context, or hopefully someone notices something I missed. Any and all suggestions would be immensely appreciated. Thank you!!
Bad Allocation Error Troubleshooting:
1) When the error was thrown for a particular subject, reprocessed that subject individually with no issues.
2) Tried different datasets (and a dataset that only included subjects that threw no error during batch processing) and still ran into the error.
3) Upgraded my machine's memory + storage (now 4 processors, 16GB Ram, 134GB Hard drive) and still get the error.
4) Clear and close everything at the end of the analysis function--still get the error.
5) A previous forum post mentioned this issue was resolved by clearing out old setup files and results from folders: this unfortunately did not resolve the issue either.