How to access memory information in Matlab on Unix is ​​the equivalent of a custom view. MaxPossibleArrayBytes

I am looking for the equivalent of data returned by windows memory in unix, in matlab.

I know about the possibility of using unix ('vm_stat'), but the specific part of the required information is the largest continuous block of free memory.

This information is returned to memory as follows:

[userview, ~] = memory;
a = userview.MaxPossibleArrayBytes

Does anyone not know how to write a unix command that could return the same information?

+5
source share
1 answer

Call the team “for free” and analyze the results. It works on linux

[r,w] = unix('free | grep Mem');
stats = str2double(regexp(w, '[0-9]*', 'match'));
memsize = stats(1)/1e6;
freemem = (stats(3)+stats(end))/1e6;

Gbytes. "" , , . . , , "" - .

Linux MATLABs mxMalloc/mxCalloc, , malloc . , , . mex , , MATLAB:

  rout = calloc(sizeof(Double),M*N);
  pargout[0] = mxCreateNumericMatrix(0,0,mxDOUBLE_CLASS,mxREAL);
  mxSetM(pargout[0], m);
  mxSetN(pargout[0], n);
  mxSetData(pargout[0], rout);
  mexMakeMemoryPersistent(rout);

, MATLAB. - . MATLAB malloc, , .

, Windows. MATLAB. , . .

+7

All Articles