Out of Memory error
12 views (last 30 days)
Show older comments
Hi, The "maximum possible array" is much lower than the physical memory leading to out-of-memory error. Is there any way I can increase the max possible array? Thanks
>> memory
Maximum possible array: 5176 MB (5.427e+09 bytes) *
Memory available for all arrays: 5176 MB (5.427e+09 bytes) *
Memory used by MATLAB: 2040 MB (2.139e+09 bytes)
Physical Memory (RAM): 32768 MB (3.436e+10 bytes)
* Limited by System Memory (physical + swap file) available.
0 Comments
Accepted Answer
Rik
on 23 Aug 2022
Matlab stores arrays in contiguous blocks of memory. I have always interpreted that to mean it cannot cross RAM-sticks (so if you have multiple 16GB sticks you can only have 16GB for each array). I don't know whether that interpretation is correct (probably not).
2 Comments
John D'Errico
on 23 Aug 2022
I don't think that is at least completely true. Say you have only 8GB of RAM.
1 - Create a double precision variable (V1) that uses 5GB of RAM.
2 - Create a scalar double precision variable (V2)
At this point, you have two variables in memory.. The memory map will have that little scalar sitting out in the wees. but where can it go?
3 - Next, clear V1
V2 does not change its location in memory. You now have two blocks of contiguous memory to be found, so even though you have 8 GB of RAM, you have only a maximum block of 5GB of contiguous memory. Clearing V2 will remove that limitation, or performing a pack command can help.
help pack
You can of course get some information about the memory available to you using the memory conmmand, (but only on Windoze systems.)
help memory
More Answers (1)
Image Analyst
on 23 Aug 2022
Edited: Image Analyst
on 23 Aug 2022
You have 32 GB of physical RAM but how much swap space have you set up? Why don't you just increase the amount of swap space?
0 Comments
See Also
Categories
Find more on Performance and Memory 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!