Automate Java Heap increase with MATLAB API

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Yasser Abdelrahman
Posts: 3
Joined: Sun Jul 25, 2021 9:00 pm

Automate Java Heap increase with MATLAB API

Post by Yasser Abdelrahman » Fri Sep 30, 2022 4:35 pm

Hello Everyone,

I am a graduate student working at UCSD under CMRG to help build an OpenSim model of a bipedal rodent called the Jerboa. I ran into an issue when running the model through the matlab API that says there is not enough Java Heap Space. I was able to fix this issue by referring to another forum that suggested manually tweaking numbers in the OpenSim Config files. However, my concern now arises from this process being completely manual, and not allowing the model to be opened automatically by other users. I wanted to inquire if there was any way to run a line of code in the OpenSim Matlab API that would automatically make these changes to allow for all users to open the model without accessing the config file. Thank you in advance for taking the time to read my message.

Best,
Yasser

Tags:

User avatar
Ayman Habib
Posts: 2238
Joined: Fri Apr 01, 2005 12:24 pm

Re: Automate Java Heap increase with MATLAB API

Post by Ayman Habib » Tue Oct 04, 2022 10:17 am

Hi Yasser,

Typically you can't change the heapsize of the Java VM while it is running (among other things there would be no guarantee that the space can be allocated), that's why these arguments are passed to the VM on construction. If you suspect the issue has to do with using large/fine mesh files for bones (typical of model building process) I'd suggest you keep low res meshes or reduced size meshes (e.g. using Meshlab to reduce mesh size) and use these instead since meshes are used exclusively for visualization. If meshes are not the issue we'd be interested to take a look at the model to provide other recommendations.

If you're trying to modify the opensim-gui config file instead from the Matlab side then it's just editing a text file (check the configureOpenSim.m that you used to configure your Matlab and locate the file) under openSimFolder/etc/OpenSim.conf. The tricky part is to handle failures if the amount of heap-space can't be allocated.

Hope this helps,
-Ayman

User avatar
Yasser Abdelrahman
Posts: 3
Joined: Sun Jul 25, 2021 9:00 pm

Re: Automate Java Heap increase with MATLAB API

Post by Yasser Abdelrahman » Tue Oct 25, 2022 9:22 am

Hello Dr. Habib,

Thank you for the prompt reply. I have assumed the issue is due to geometries, as when I reduce the quantity in the model the error no longer appears and I can visualize the stls. However, I have decimated and reduced the mesh size significantly in meshlab and geomagic with no changes. I've attached the opensim model here if it is of any use, and in the meantime I will investigate using matlab to update the heap space. I was unable to attach the geometries through the forum, so if there is a better way to send those I'd be happy to. Thank you for all the help.

Best,
Yasser
Attachments
Jerboa _MUSK.osim
(248.42 KiB) Downloaded 1 time

POST REPLY