memory
- : memory
()¶ - :
[userdata, systemdata] =memory()¶ Report how much memory Nexus and the system are using.
Called without outputs, a short table of the current figures is printed. With outputs nothing is printed and two structures are returned.
userdata describes the Nexus process:
MaxPossibleArrayBytesUpper bound on the size of one array, counting physical memory and swap together. Allocating anything close to this will make the machine swap heavily and may destabilise it. Address-space fragmentation, which can lower the true limit on 32-bit systems, is not taken into account.
MemAvailableAllArraysMemory available to Nexus in total, in bytes.
ram_available_all_arraysMemory available in physical RAM alone, in bytes, with the same caveat about fragmentation.
MemUsedMATLABmem_used_nexusMemory in use by this process, including swapped pages, in bytes. The first name exists for compatibility with scripts written for other systems.
ram_used_nexusPhysical memory in use by this process, in bytes.
systemdata describes the machine:
PhysicalMemory.AvailablePhysicalMemory.TotalFree and installed physical memory, in bytes.
SystemMemory.AvailableSystemMemory.TotalFree and installed memory including swap, in bytes.
VirtualAddressSpace.AvailableVirtualAddressSpace.TotalFree and total virtual address space of the process, in bytes.
Example: print the table.
memory () ⇒ System RAM: 16294184 KiB, swap: 2097148 KiB Nexus RAM: 214840 KiB, virt: 1512344 KiB Free RAM: 9011720 KiB, swap: 2097148 KiB Available RAM: 11108868 KiB, total: 13206016 KiB
Example: pick out one figure.
[u, s] = memory (); fprintf ("%.1f GiB of RAM free\n", s.PhysicalMemory.Available / 2^30);This function is available on Linux and Windows. On other systems it issues a warning and returns nothing.