Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8508219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:06:06+00:00 2026-06-11T03:06:06+00:00

I am looking for an equivalent of the data returned by memory on windows

  • 0

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

I am aware of the possibility of using unix(‘vm_stat’), but the specific part of information I require is the largest contiguous free memory block.

This information is returned by memory as follows:

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

Does anybody no how to write a unix command that could return this same information?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:06:08+00:00Added an answer on June 11, 2026 at 3:06 am

    Call command ‘free’ and parse the results. This 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;
    

    The output is in Gbytes. The last number free returns is ‘cached’ memory used by the OS, e.g. dynamic libraries. It can in general be used, but you can decide to leave it out and just use what free reports as ‘Free’ – the third numerical field in the output.

    Edit On Linux, memory allocation within MATLABs mxMalloc/mxCalloc most likely simply calls malloc and friends. To get a hint that this is the case do the following experiment. In a mex file allocate an array using the following code, and return it to 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);
    

    You can normally use the variable returned in MATLAB. You can even clear it – this does not cause any problems. If indeed MATLAB simply uses malloc, there is no way that I know of in which they can enforce physically contiguous memory.

    I know that you can not run the above code on Windows though. This code crashes MATLAB. Of course, you should not do that in your codes. It merely illustrates the point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a python 2.7 data structure equivalent to a dictionary but where
I am looking for the C# equivalent of Spring MVC's url mapping using annotations
I'm looking for a book (or equivalent) to help me go from using hg
I'm looking for a ASP .NET Caching equivalent for a PHP website app using
I'm looking for an equivalent of PerlCritic for PHP. PerlCritc is a static source
I'm looking for the equivalent of what in js would be 'this is a
I'm looking for the equivalent to the PHP function mysql_real_escape_string() to use in C#.NET.
I'm looking for the equivalent of [\w]&&[^\d] (Of course && is not a regex
I am looking for an equivalent pattern in multi-threading in iOS as there is
Looking for a RAM disk API (or equivalent set of software to implement) to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.