memory() command does not work on Linux or Mac.
- check available RAM with Matlab or GNU Octave: memfree.m
- check if an array can be created in RAM: checkRAM.m with Matlab or GNU Octave.
Preferences → MATLAB → Workspace → Matlab array size limit attempts to stop the user from creating arrays that dig into swap memory (extremely slow).
Related: free disk space check Matlab