out of memory

1 view (last 30 days)
Ieva
Ieva on 16 Mar 2012
Hi,
While working with Matlab I get "out of memory" message.
Memory status is as following:
Maximum possible array: 1032 MB (1.082e+009 bytes)
Memory available for all arrays: 1465 MB (1.536e+009 bytes)
Memory used by MATLAB: 302 MB (3.169e+008 bytes)
Physical Memory (RAM): 2999 MB (3.145e+009 bytes)
Is there some easy was I could allocate more memory for Matlab? For example, is it possible to do by writing a line in code?
Would be grateful for your help.
Ieva
  1 Comment
Daniel Shub
Daniel Shub on 16 Mar 2012
Sometimes it helps to search around before asking. This question was asked yesterday also: http://www.mathworks.com/matlabcentral/answers/32332-increase-memory-used-by-matlab

Sign in to comment.

Answers (2)

Jason Ross
Jason Ross on 16 Mar 2012
The short answer: no. You can't write code to increase the memory allocated to MATLAB. There's a certain base amount that it takes to run, but memory is also occupied by the operating system and As MATLAB needs more memory, it will take it, up to the limit allowed by the operating system. I'm assuming you are running on a 32-bit operating system, for which this number is roughly 2^32 bytes. If you need to go beyond that, you need to move to a 64-bit OS.
Ways to attempt to get a bit more out of your system:
  • Right now you show 3GB of RAM installed. Can you upgrade to 4GB? RAM is pretty inexpensive.
  • You can try upping the amount of virtual memory (aka swap) on the system. This will give a higher number, but performance plummets when a system has to use virtual memory heavily.
The bottom line is that if you are having memory issues you can try a few tricks, but eventually you are going to be caught by the OS limits and and you need to move to 64-bit. There is a technote that goes into more detail here:
  3 Comments
Jason Ross
Jason Ross on 16 Mar 2012
It would let the OS reside there, freeing up a bit of space. It's also possible to try the /3GB switch if it's not already enabled.
But overall we are talking about picking up a low number of MB. The preferred route is going 64-bit for anyone hitting memory issues on a 32-bit system. Most hardware has supported 64-bit for some time, as have the major OS vendors, and most users will not even know they are running on a 64-bit OS -- 32-bit applications continue to run fine (except for a few edge cases), and the 64-bit applications throw off the per-process memory limit for cases like these.
Jason Ross
Jason Ross on 16 Mar 2012
And, of course the other answer may lie with some coding techniques -- technote 1107 (http://www.mathworks.com/support/tech-notes/1100/1107.html) has some things to look out for and some techniques for doing that. But this probably turns into a losing race eventually, and the 64-bit option becomes the much easier path.

Sign in to comment.


Ashutosh
Ashutosh on 18 Mar 2012
i am generating some code for electromagnetic simulation in which I design a structure using some code and do triangulation meshing using delaunay function. But if do mesh refinement and my matrix size grows leading to out of memory error. I have 8gb RAM in my PC..can you suggest how to make MATLAB access my full RAM and also HDD (320GB) so that i can generate and use larger matrices of the order of 10000 x 10000. Currently I can go upto only 5000 x 5000
  1 Comment
Walter Roberson
Walter Roberson on 18 Mar 2012
In your system control panel, allocate more memory for swap space.
Be warned that using swap space is MUCH slower than using RAM.
When you asked about this before, there were questions put to you about why you are running out of memory, as a 10000 x 10000 array of double precision would occupy less than 800 megabytes. Geoff asked you, "Are you running a 64-bit operating system with the 64-bit edition of MatLab installed?", but you did not answer, and you did not show us your memory allocation as Geoff suggested you should do. We cannot answer your question properly without further facts from you.

Sign in to comment.

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!