Matlab platform independent free memory
Matlab’s built-in memory()
command does not work on Linux or Mac.
Our matlab-stdlib provides ways to do this on any OS.
Check available RAM with Matlab or GNU Octave: stdlib.sys.memfree
.
Check if an array can be created in RAM: stdlib.sys.checkRAM
.
Matlab option Preferences → MATLAB → Workspace → Matlab array size limit
attempts to stop the user from creating arrays that dig into swap memory (extremely slow).

Matlab array limit
Related: free disk space check Matlab