Will I receive "Out of Memory" error eventually: Both the "Memory available for all arrays" and "Memory used by Matlab" increase

1 view (last 30 days)
Hi, I have a Matlab program that need to run for months continuously. I keep monitoring the memory usage by using "memory" command periodically. What I observed is that both the "Memory available for all arrays" and "Memory used by Matlab" increase over time. For about half a day. "Memory available for all arrays" increases by 48MB, while "Memory used by Matlab" increases by 31MB. I do have a task that runs periodically at high rate, with a call to a mex function. But there is no memory allocation during runtime. Will my program crash with "Out of memory" error eventually? Which memory in memory command is the actual limit that cause the "Out of memory" error?

Accepted Answer

Guillaume
Guillaume on 13 Apr 2017
Well, if both the memory available and the memory used keep on increasing with the available increasing faster than that used, then you're safe since on balance there's more memory available for matlab. Of course, if the memory available for all arrays increases while the memory used by matlab also increases that means that some other program is using less memory. So, at some point that other program will settle down to its minimum usage and then the increased usage by matlab may be become a problem.
Whether or not you'll run out of memory depends on how much memory you have, how long you want to run for and what the rate of memory increase is. You'll get a out of memory error if:
  • memory available for all arrays decreases to 0
  • you try to increase the size of an existing array (e.g. by adding elements) so that its memory requirement are higher than maximum possible array size.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!