- The code changed
- the input values or the values produced by a random process changed
- There are additional background processes or global variables being stored that weren't a problem previously
- Something in your startup.m file (if you have one) is affecting memory.
- Perhaps the first time you ran it, the code correctly ended before reaching memory capacity.
- Maybe, just maybe, the first time you ran it you missed the error message.
Memory error when code ran fine before
1 view (last 30 days)
Show older comments
I'm running a code (using R2016a, Windows 10) which requires several large matrices to exist simultaneously (4 3744×256×159 matrices). I've cleared as much of the unrequired variables as possible. What is unusual is that I ran this code overnight for about 10 loops a few days ago and it worked fine. Now when I run it it won't go past the first iteration without giving an out of memory error. I have closed matlab, restarted the computer and restarted matlab in between but have not added anything to the computer or opened any other programmes which would take up RAM compared to the previous successful run. This would suggest that matlab is holding on to some data from the previous run but I don't know how to overcome this.
Any advice would be much appreciated
1 Comment
Adam Danz
on 29 May 2020
Do you have a startup.m file and if so, is it doing something that would affect memory?
Small correction to your question; any values with >2 dimensions are called arrays. Matrices are only 2D.
There are lots of possible explanations.
Answers (2)
Manas Meena
on 10 Feb 2021
You can try changing the TMP file to a different folder. But as Adam suggested there can be several possible explanations to this issue.
0 Comments
Aditi
on 12 Sep 2023
Hi, I have the same problem.
Have used a code for years and ran it on thousands of datasets (3D medical images, size 512x512x100). now for some reason, MATLAB says out of memory at a specific point in the code when nothing has changed in the code or the type of input file/variable and its the same computer. ran fine 2 months ago. the license did change to a different university - can that have an effect??
its running on smaller sized variables (124x124x100) but I've run it on much larger files many times before, no problem. rest all input variables are the same and its a very optimized code written and published and used by several groups. what could the issue possibly be? I've tried looking everywhere
0 Comments
See Also
Categories
Find more on Startup and Shutdown 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!