What is your Memory Load Percentage?
by admin on Oct.13, 2009, under c#
Here’s a console utility to print it out:
‘ File: MemLoad.vb
imports System.Runtime.InteropServices
Module module_memoryload
structure MEMORYSTATUSEX
public Length as Integer
public MemoryLoad as Integer
public TotalPhys as LONG
public AvailPhys as LONG
public TotalPageFile as LONG
public AvailPageFile as LONG
public TotalVirtual as LONG
public AvailVirtual as LONG
public AvailExtendedVirtual as LONG
End Structure
Declare Function GlobalMemoryStatusEx lib “kernel32″ _
(ByRef ms As MEMORYSTATUSEX) As Boolean
sub main(ByVal args() As String)
dim ms as new MemoryStatusEx
ms.Length = Marshal.Sizeof(ms)
if GlobalMemoryStatusEx(ms) then
Console.WriteLine(“- Memory Load: {0}%”, ms.MemoryLoad)
end if
end sub
end Module