Out of memory error
Show older comments
I'm running a long and complex program for data analysis that runs perfectly fine on a colleague's computer.
However, when I try to run it, I get the following error:
??? Out of memory. Type HELP MEMORY for your options.
Error in ==> NonRephasingC16_120 at 216
SR(tn,:,:)=SS;
(the last line is the line of code in which it apparently breaks, NonRephasingC16_120 is the name of the program.)
Typing "HELP MEMORY" yields that I should run the "memory" command, which gives the following results:
>> memory
Maximum possible array: 148 MB (1.555e+008 bytes) *
Memory available for all arrays: 822 MB (8.624e+008 bytes) **
Memory used by MATLAB: 889 MB (9.319e+008 bytes)
Physical Memory (RAM): 3571 MB (3.745e+009 bytes)
* Limited by contiguous virtual address space available.
** Limited by virtual address space available.
I've tried the pack command and closing all other programs on the computer. I've also attempted to mess with the code to see if I can make the offending array smaller, but it does not look like it can be done. Yes, we are certain that the program being run is identical.
Is there some kind of setting I can change, either in Matlab or on my computer, that will enable it to run properly? If I have to get a new computer, what parameter would help this to run well?
I'm currently running windows 7, as is my coworker who can run the program. My computer is a dell optiplex 980. Matlab version is 7.11.0(R2010b)
Accepted Answer
More Answers (2)
Jan
on 21 Jun 2018
2 votes
- Install more RAM
- Close other applications
- Install more RAM
- Increase the virtual memory
- Use a 64 bit version of Matlab and the operating system
- Pre-allocate variables instead of letting them gro iteratively
- Use single or uint8/16/32 if applicable instead of double arrays
- Install more RAM
- Check for typos: rand(1e6) is much larger than rand(1, 1e6)
1 Comment
Ameer Fahmi
on 9 Apr 2020
I had the same problem recently, my laptop had 4GB RAM and I was using a computationally intensive code. I tried all possible solutions but it only worked when I installed more RAM, I upgraded the RAM from 4GB to 16GB and now everything is fine
Bijen Khagi
on 28 Dec 2021
0 votes
Increase your virtual memory, that will do all.
1 Comment
Walter Roberson
on 28 Dec 2021
The original poster had a 32 bit version of Windows. Increasing virtual memory would not have helped; the 32 bit operating system could not access as much memory as was needed by the user.
Categories
Find more on Introduction to Installation and Licensing 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!