This tutorial will discuss how to check the memory limits and the maximum size of the array possible using the
memory command in MATLAB.
Checking the Memory Limits and the Maximum Size of the Array Possible Using the
memory Command in MATLAB
The maximum allowed size of the array is limited because of the hardware limitation of the device on which you are running MATLAB. For example, if your device has an 8 GB of physical ram, then the maximum possible array size will be around 4 GB because the rest will be taken by windows and MATLAB. You can always check the available memory for the array using the
memory command in the command window of MATLAB. For example, let’s check the available memory using a laptop of 8GB ram. See the code and output below.
Maximum possible array: 4544 MB (4.765e+09 bytes) *
Memory available for all arrays: 4544 MB (4.765e+09 bytes) *
Memory used by MATLAB: 2499 MB (2.621e+09 bytes)
Physical Memory (RAM): 8071 MB (8.463e+09 bytes)
* Limited by System Memory (physical + swap file) available.
In the above code, you can see that the memory available for all arrays is 4544 MB, and the rest is being used by windows and MATLAB.