Memory error when code ran fine before

조회 수: 1 (최근 30일)
Roisin McM
Roisin McM 2020년 5월 29일
답변: Aditi 2023년 9월 12일
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
Adam Danz
Adam Danz 2020년 5월 29일
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.
  • 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.

댓글을 달려면 로그인하십시오.

답변 (2개)

Manas Meena
Manas Meena 2021년 2월 10일
You can try changing the TMP file to a different folder. But as Adam suggested there can be several possible explanations to this issue.

Aditi
Aditi 2023년 9월 12일
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

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by