out of memory ?? help needed
38 views (last 30 days)
Show older comments
I have a laptop which has a 8G of ram memory.
however, when I run a matlab, it says I am out of memory.
I only run matlab only, and closed all other unnecessary windows.
I am pretty sure I have a sufficient memory to run the matlab program.. but yeah this happend..
Any suggestion or solution for this issue?
I already tried following stuff..
1- Give higher priority to Matlab.exe task. You can do that by going to task manager, Processes tab, right click the Matlab.exe Task, select priority and set it to higher priority (say real time), this tells Windows to allocate more resources to this process.
2- Increase the page file size of your applications in general. You can do this by right clicking MyComputer ->properties->Advanced System Settings ->Advanced-> Performance->Virtual Memory (change..). Then the tick from the Automatic .... and set the initial and maximum page size to say 10000 MB.
3- While in 2 at Performance, make sure that the it is set for "Programs" and not for "Background services". "Programs" should be the default.
4- Also make sure while doing step 2 that the >Visual effects tab of "performance options" is set to "Adjust for best performance" . This will remove lots of animation, shades, fades and and other visual effects from your screen (the next time you re-boot) but free some memory for the applications including the MATLAB. I used this trick with my older laptop which was 32 bits OS and used to have a profound impact on applications performance.
5 Comments
M Shujah Islam Sameem
on 3 Dec 2021
Go to Home -> Preference icon -> Workspace" : Uncheck the 'Limit the maximum array size to a percentage of RAM
Accepted Answer
Guillaume
on 3 Sep 2014
On a 32 bit OS with 32 bit matlab, matlab can only 2GB (3GB with some special settings) regardless of how much memory you have on your computer.
None of the changes you've made would make any significant difference, and to be honest you're better off restoring things to their default settings. Increasing Java heap memory won't help either, if anything by doing that you may reduce the memory available for array allocation.
Your only option is to reduce the memory requirements of your code. Do you need to have all the images in memory at the same time? Maybe you can process them one at a time. If not, you'll have to use a different data type for your images. If you can use uint8 instead of double, that's already reducing the memory needed by a factor of 8.
It's hard to tell you what to do without more details. At the command line, write
dbstop if error
and provide the output of
memory
and
whos
when the code fails.
4 Comments
Pedro Santos
on 7 Jan 2015
YJ what you did for use all your memory on matlab? I have the same problem that you had but the difference is that i already have 64 bits in matlab and windows. The problem is that i don't know how to alocate more memory for use in matlab. Can you help me?
More Answers (4)
mrwen mrwen
on 22 Mar 2017
I solved the problem, and it works well, you can follow these steps.
- Go to Home -> Preference icon -> General -> Java Heap Memory -> Allocate what size of memory you want
- In Preference window, go to "Workspace" (out of Java heap memory level) -> See "Matlab Array size limit"
Make sure uncheck the 'Limit the maximum array size to a percentage of RAM'. Because you want to extend memory
so we don't need this feature.
- Done.
0 Comments
Julia
on 3 Sep 2014
Hi,
I once got an out-of-memory error while using a feature of the report generator.
I solved it by allocating more java heap memory to Matlab:
Preferences (in the Matlab tab "Home") --> General --> Java Heap Memory
Mohsin Ali
on 20 Oct 2015
Edited: Mohsin Ali
on 20 Oct 2015
hi i am using 64 bit version of matlab on 64 bit operating system windows 7. I am facing the same problem I have increasing the jave heap size and tried all the above recommendations. my computer specifications are, i am using it on Intel Xeon having 64GB of RAM. Matlab shows following results when I ran 'memory' and 'whos' commands
Maximum possible array: 124730 MB (1.308e+11 bytes)
Memory available for all arrays: 124730 MB (1.308e+11 bytes)
Memory used by MATLAB: 1014 MB (1.064e+09 bytes)
Physical Memory (RAM): 65535 MB (6.872e+10 bytes)
Limited by System Memory (physical + swap file) available.
Name Size Bytes Class Attributes
Problem 1x1 172686122 struct
cnt 1x1 8 double
index 1x1 1339842 struct
q 148770x148770 171455800 double sparse
x 1x1 8 double
y 1x1 8 double
1 Comment
Guillaume
on 20 Oct 2015
Please start your own question rather than posting a question in an answer. And particularly, state what problem you are facing. As you've got tons of memory surely you're not running out of memory?
Note that changing OS settings (like process priority, page file size, etc.) without knowing the implication is not a good idea. The benefit may be marginal and result in instabilities.
Particularly, increasing the java heap size will reduce the memory available to matlab for array allocation. Just because it says memory in the setting does not mean it has anything to do with the memory used by matlab for arrays. This is memory used for java that affects things like GUI.
Kalai Chelvi
on 21 Nov 2016
HI, Am using a lap with 4GB RAM, 64 bit Win-7 OS and 64 bit Matlab-2013 version. When I am trying to use 'wavedec' command for an image of size 217x181 for level 1, I got "out of memory" error. Can any one tell me how to rectify it please ???
0 Comments
See Also
Categories
Find more on Java Package Integration 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!