How do I get WIndows system memory information?

The Dyalog "Knowledgebase". This forum is read-only
Forum rules
The FAQ is a read-only forum which is in general updated only by employees of Dyalog Ltd. It replaces the FAQ page which existed under http://www.dyalog.com. Rather than rejecting other posts to this forum, such posts will be put in a moderation queue, and moved to a more appropriate forum.

How do I get WIndows system memory information?

Postby Vince|Dyalog on Wed Sep 07, 2016 10:31 am

You can use ⎕NA to query the Windows Operating system to get Windows system memory information:

Code: Select all
 r←GlobalMemoryStatusEx;get;rc
⍝ See https://msdn.microsoft.com/en-us/library/windows/desktop/aa366770(v=vs.85).aspx
 'get'⎕NA'U kernel32∣GlobalMemoryStatusEx ={U U {U U} {U U} {U U} {U U} {U U} {U U} {U U}}'
 (rc r)←get⊂64 0,7⍴⊂0 0
 :If rc≠1 ⋄ (⍕rc)⎕SIGNAL 11 ⋄ :EndIf
 (2↓r)←1E¯9×(2*32)⊥∘⌽¨2↓r ⍝ Gigabytes
 r←'Load(%)' 'TotalPhys' 'AvailPhys' 'TotalPageFile' 'AvailPageFile' 'TotalVirtual' 'AvailVirtual',⍪1↓¯1↓r



Example usage and output:

GlobalMemoryStatusEx
Load(%) 72
TotalPhys 16.9696215
AvailPhys 4.730630144
TotalPageFile 25.35632486
AvailPageFile 13.19555891
TotalVirtual 8796.092891
AvailVirtual 8795.017429
Vince|Dyalog
 
Posts: 406
Joined: Wed Oct 01, 2008 9:39 am

Return to Frequently Asked Questions (FAQ)

Who is online

Users browsing this forum: No registered users and 1 guest