sbiosimulate Not Releasing Memory
조회 수: 1(최근 30일)
표시 이전 댓글
I have a somewhat large model, that I am simulating (repeatedly with slight variations of the parameters) in Simbiology, that is consistently resulting in "Out of Memory" errors.
I can see with the `memory` command when I run the line:
simData = sbiosimulate(virtualPatientModel,configSettings,doses)
that the "Memory used by MATLAB" jumps about 4GB with each iteration (so it doesn't get through many iterations).
If I run clear simData the memory is not released (though the variable is removed from the workspace). If I run clear all the memory is not released.
Setting the number of output times to reasonably small, and logging only 2 species does not reduce the additional memory used with each iteration.
If I assign a variable to every property of simData, I can see with the whos command that none of them are using much memory (KBs at most).
So I'm confused about what is actually using the memory and how to release it.
This behavior is consistent in R2022a and R2020b, with sundials and ode23t. (The integration is extremely slow with ode45 and ode15s).
Unfortunately I cannot share this model because both the structure and the parameters are proprietary, and I have been unsuccessful in making a minimal working example. (Clearing simData releases the memory as expected in the smaller model, and reducing the output times reduces the memory accumulated with each iteration.)
What is causing this? How do I diagnose or fix it?
댓글 수: 0
Arthur Goldsipe 2022년 11월 3일
My guess is that this memory usage is somehow associated with SimBiology models that are still in memory. If you want to reclaim memory associated with a SimBiology model you must explicitly call delete on that model, for example delete(virtualPatientModel). If each iteration creates a new model without deleting any models, that could very well explain the memory usage. You see all the models that are still in memory by calling sbioroot and looking at the Models property. You can access these models and delete them via this property. You can also call sbioreset to delete all models that are in memory.
If that doesn't solve your problem, then my suggestion would be to contact technical support, especially if you are comfortable sharing reproduction steps with them. We can also potentially help you "obfuscate" the details of any model before you share it.
If you can't share the actual model, can you share the code that does the iteration? That might give us some insight into what is using memory. It might also help to know more about how many species, parameters, reactions, and such are in your model. And how many time points are logged in each simulation.
I hope that gives you some ideas that help.
댓글 수: 1
더 많은 답변 보기: SimBiology Community
Find more on Scan Parameter Ranges in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!