matlab "memory" function on mac?
On Windows machines, MATLAB users can use either the memory
or the feature memstats
commands. However, neither of these work on a machine, failing as follows:
>> memory ??? Error using ==> memory Function MEMORY is not available on this platform. >> feature memstats ??? Error using ==> feature An unknown feature was specified
Does anyo开发者_JS百科ne know of a way to access information about in-matlab memory usage on a Mac?
I have not been able to find a command that reproduces the functionality of memory
. However, if you know how much total memory your system has, you can use who
(or vsize
from the file exchange for more detail) to estimate how much memory your variables are currently using and thus how much free space you have.
By the way, you can always find out about Java memory by calling
java.lang.Runtime.getRuntime.maxMemory
java.lang.Runtime.getRuntime.totalMemory
java.lang.Runtime.getRuntime.freeMemory
Note that Matlab memory and Java memory are different - Java memory is used for UI, including figures, as well as other java objects, while memory
reports the memory available for variables and calculations.
memory
is only available on Windows systems.
You can try using top
built-in Mac command instead.
I know this question is old and already answered, but for anyone else looking for this answer, an alternative that works on all platforms it to use whos:
allvars = whos;
memused = sum([allvars.bytes]);
This assumes you only have one workspace being used by your script/function. If you have a script that uses multiple workspaces, you'll need to specify all the different workspaces and add them together.
精彩评论