clear import org.opensim.modeling.* in MATLAB

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Hide Kimpara
Posts: 135
Joined: Mon Sep 19, 2016 5:12 am

clear import org.opensim.modeling.* in MATLAB

Post by Hide Kimpara » Tue May 15, 2018 11:01 am

Hello,

I found runtime memory of MATLAB increased so much during OpenSim simulation. When I had some simulations until 10 s of problem time, MATLAB occupied RAM more than 10 GB(!). I made clear command for all variables with relatively large arrays. But the situations have not been improved so much.

Now I am thinking about associated memory with org.opensim.modeling.*. Since methods of OpenSim are necessary to handle state variables of OpenSim, I declared "import org.opensim.modeling.*" in several sub-functions of MATLAB. But there is no method to clear org.opensim.modeling.* in sub-functions.
I recognize that "clear import" can make org.opensim.modeling.* clear from MATLAB, but it's valid on command-line only. The ''clear import" is not available in MATLAB function or script.

Is there any ideas or methods to clear org.opensim.modeling.* from MATLAB sub-functions? Is it thing, only Mathworks can solve?


Thank you,
Hide

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: clear import org.opensim.modeling.* in MATLAB

Post by Christopher Dembia » Tue May 15, 2018 11:54 am

There is nothing to clear with `import org.opensim.modeling.*;`. All this line does is allow you to use OpenSim classes without fully qualifying them. That is, this line allows you to type `Model()` instead of `org.opensim.modeling.Model()`. There is no memory allocation from this line.

User avatar
Hide Kimpara
Posts: 135
Joined: Mon Sep 19, 2016 5:12 am

Re: clear import org.opensim.modeling.* in MATLAB

Post by Hide Kimpara » Tue May 15, 2018 12:06 pm

Hi Chris,

Thank you for your prompt responses. I see the clear of org.opensim.modeling.* cannot become any solutions for us. But it's tough to understand why MATLAB uses so much huge runtime RAM memory although any storage for force or bodykinematics were not enabled.
Probably, I may think another solution with accepting this phenomenon.

Thank you, Hide

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: clear import org.opensim.modeling.* in MATLAB

Post by Christopher Dembia » Tue May 15, 2018 8:44 pm

Try running `java.lang.System.gc()`. Also, make sure you're not holding onto variables that you no longer need. If that doesn't help, then OpenSim might have a memory leak. It would help if you could isolate what is causing the leak.

POST REPLY