Matlab out of memory

13 Ansichten (letzte 30 Tage)
Ajai Singh
Ajai Singh am 7 Sep. 2022
Beantwortet: Aditya am 14 Sep. 2022
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 :
K>> memory
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?
Thank you.

Antworten (1)

Aditya
Aditya am 14 Sep. 2022
Hi,
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:
  • There is insufficient memory for your largest array
  • There is insufficient memory for all data used in the script
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)

Produkte


Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by