octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #9924] Suggestion for a memory() function


From: Markus Mützel
Subject: [Octave-patch-tracker] [patch #9924] Suggestion for a memory() function
Date: Tue, 21 Apr 2020 12:27:53 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0

Follow-up Comment #3, patch #9924 (project octave):

For Windows, it's probably possible to query the memory usage of Octave with
"GetProcessMemoryInfo" [1] for the handle returned by "GetCurrentProcess" [2].
Information about the system memory could probably be retrieved with
"GlobalMemoryStatusEx" [3].
Maybe I could provide the code for a preliminary .oct file that returns that
data if that is of interest for you.

"memory" already has a second output argument including information about the
total and *physical* memory. So imho, there is no need to add a field
"RamAvailableAllArrays" in the first output argument. But maybe I'm missing
the point...

I was not sure what the difference was between "MaxPossibleArrayBytes" and
"MemAvailableAllArrays". It seems to be the same when I call "memory" on
Windows 10 64bit here. Maybe the answer is here: [4].
Also SystemMemory.Available seems to be lower than PhysicalMemory.Available
here (32 GiB RAM). Any idea what that means?
Virtual memory (2-8 GiB dynamic, currently 2 GiB) seems to be not included in
the results. But that might be a local issue.


>> [a, b] = memory ()

a = 

  struct with fields:

    MaxPossibleArrayBytes: 2.0897e+10
    MemAvailableAllArrays: 2.0897e+10
            MemUsedMATLAB: 1.6874e+09

b = 

  struct with fields:

    VirtualAddressSpace: [1×1 struct]
           SystemMemory: [1×1 struct]
         PhysicalMemory: [1×1 struct]

>> b.VirtualAddressSpace

ans = 

  struct with fields:

    Available: 1.4072e+14
        Total: 1.4074e+14

>> b.SystemMemory

ans = 

  struct with fields:

    Available: 2.0897e+10

>> b.PhysicalMemory

ans = 

  struct with fields:

    Available: 2.2551e+10
        Total: 3.4225e+10


The Matlab documentation contains this [5]:
> MATLAB computes the value for Memory Used By MATLAB by walking the MATLAB
process memory structures and summing all the sections that have physical
storage allocated in memory or in the paging file on disk.
Not exactly sure what that means and if we should care about this. Querying
that info from the OS is probably good enough...

[1]:
https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-getprocessmemoryinfo
[2]:
https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentprocess
[3]:
https://docs.microsoft.com/de-de/windows/win32/api/sysinfoapi/ns-sysinfoapi-memorystatusex
[4]:
https://stackoverflow.com/questions/4679439/find-largest-allocation-of-memory-possible
[5]: https://de.mathworks.com/help/matlab/ref/memory.html#brl4003

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/patch/?9924>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]