필터 지우기
필터 지우기

how resolve Get out of memory error in Matlab?

조회 수: 2 (최근 30일)
sasa
sasa 2014년 8월 26일
댓글: sasa 2014년 9월 6일
I have matlabR2013a on a 4GiG RAM system and window7. I have the code below:
c = x'*x/(n-d);
x is a 28944*30 double matrix and n and d are 1*1 matrix(a number). when I run this line of code I got error: Out of memory. Type HELP MEMORY for your options.
how can I fix this error? I increase the amount of virtual heap memory but no thing changed!
thanks for your help.

답변 (1개)

Guillaume
Guillaume 2014년 8월 26일
If Windows 7 is the 32 bit version, then Matlab can't use more than 2 GB (3GB if you mess about with the OS). If you're using the 32 bit version of Matlab on a 64 bit OS, then you're limited to under 4 GB.
However, the memory footprint of the arrays you're listing is minimal. On my machine x is about 6 MB. You'll need another 6MB free to temporarily store the transpose and possibly 6MB for x/(n-d), but it shouldn't tax your system.
Check how much memory you have free with
memory
In particular, Maximum possible array tells you what is the max. size of a single array.
Check how much the existing variables use with
whos
Clear the variables you don't need.
FInally have a look at this page (and of course do type HELP MEMORY as instructed).
  댓글 수: 5
Guillaume
Guillaume 2014년 8월 27일
No, it's not a restriction of matlab. If you do want to create a 28944 x 28944 matrix, it will use over 6GB of memory regardless of the program.
You could halve the memory usage by switching to single instead of double but it's still more memory than you have.
If you do want to calculate an array of that size, your only option is to calculate part of it, save it to disk, calculate another part, save it to disk, and so on.
sasa
sasa 2014년 9월 6일
Thanks alot Guillaume.

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by