- There is insufficient memory for your largest array
- There is insufficient memory for all data used in the script
Matlab out of memory
조회 수: 10(최근 30일)
표시 이전 댓글
Ajai Singh 2022년 9월 7일
Hello everyone ,
I am trying to solve an interpolation problem in 18 dimensions using RBF kernel and there are 60000 query points. Although I have vectorized my code for RBF Kernel but still matlab throws the out of memory error and when I run the memory command by creating a breakpoint just before the line that throws the error I get the following results :
Maximum possible array: 115929 MB (1.216e+11 bytes) *
Memory available for all arrays: 115929 MB (1.216e+11 bytes) *
Memory used by MATLAB: 4540 MB (4.760e+09 bytes)
Physical Memory (RAM): 130937 MB (1.373e+11 bytes)
* Limited by System Memory (physical + swap file) available.
Is there anything I can do to get rid of this problem?
Aditya 2022년 9월 14일
I understand that you are encountering out of memory error when executing MATLAB code.
The statement “Limited by System Memory (physical + swap file) available.” has two meanings:
The best way to handle out of memory errors is to rewrite the code.
You can start by debugging the code for any logical errors. For example, check if you accidently create huge arrays e.g., by rand(1e6) if rand(1, 1e6) was meant.
You may need to rethink the data structures being used in the program and how they are manipulated. For e.g., using single instead of double, inefficient usage of structs/cells, using sparse arrays as much as possible etc. Please see Strategies for Efficient Use of Memory - MATLAB & Simulink (mathworks.com) for more information.
If the issue persists, you are limited by the memory on the machine that you are using. You can adjust settings to increase the available memory for MATLAB as explained in Resolve "Out of Memory" Errors - MATLAB & Simulink (mathworks.com)
Find more on Multidimensional Arrays 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!