Javascript code:
/*
    typedef struct _MEMORYSTATUSEX {
      DWORD     dwLength;                       0
      DWORD     dwMemoryLoad;                   4
      DWORDLONG ullTotalPhys;                   8
      DWORDLONG ullAvailPhys;                   16
      DWORDLONG ullTotalPageFile;               24
      DWORDLONG ullAvailPageFile;               32
      DWORDLONG ullTotalVirtual;                40
      DWORDLONG ullAvailVirtual;                48
      DWORDLONG ullAvailExtendedVirtual;        56
    } MEMORYSTATUSEX, *LPMEMORYSTATUSEX;
*/
var DIV = 1024;
var _MEMORYSTATUSEX = Interop.Allocate(64);
    _MEMORYSTATUSEX.WriteDWORD(0, _MEMORYSTATUSEX.Size);
Debut.Trace('RetVal: '+Interop.Call('kernel32', 'GlobalMemoryStatusEx', _MEMORYSTATUSEX));
 
Debug.Trace('There is '+_MEMORYSTATUSEX.ReadDWORD(4)+' percent of memory in use.');
Debug.Trace('There are '+_MEMORYSTATUSEX.ReadDWORD(8)/DIV+' total KB of physical memory.');
Debug.Trace('There are '+_MEMORYSTATUSEX.ReadDWORD(16)/DIV+' free  KB of physical memory.');
Debug.Trace('There are '+_MEMORYSTATUSEX.ReadDWORD(24)/DIV+' total KB of paging file.');
Debug.Trace('There are '+_MEMORYSTATUSEX.ReadDWORD(32)/DIV+' free  KB of paging file.');
Debug.Trace('There are '+_MEMORYSTATUSEX.ReadDWORD(40)/DIV+' total KB of virtual memory.');
Debug.Trace('There are '+_MEMORYSTATUSEX.ReadDWORD(48)/DIV+' free  KB of virtual memory.');
Debug.Trace('There are '+_MEMORYSTATUSEX.ReadDWORD(56)/DIV+' free  KB of extended memory.');