' Display information about the current process's memory
' usage.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal _
e As System.EventArgs) Handles MyBase.Load
Dim proc As Process = Process.GetCurrentProcess()
AddItem(lvMemory, "Min Working Set", _
(CDbl(proc.MinWorkingSet).ToFileSize()))
AddItem(lvMemory, "Max Working Set", _
(CDbl(proc.MaxWorkingSet).ToFileSize()))
AddItem(lvMemory, "Non-paged Memory Size", _
(CDbl(proc.NonpagedSystemMemorySize64).ToFileSize()))
AddItem(lvMemory, "Paged Memory Size", _
(CDbl(proc.PagedMemorySize64).ToFileSize()))
AddItem(lvMemory, "Paged System Memory Size", _
(CDbl(proc.PagedSystemMemorySize64).ToFileSize()))
AddItem(lvMemory, "Peak Paged Memory Size", _
(CDbl(proc.PeakPagedMemorySize64).ToFileSize()))
AddItem(lvMemory, "Peak Virtual Memory Size", _
(CDbl(proc.PeakVirtualMemorySize64).ToFileSize()))
AddItem(lvMemory, "Peak Working Set", _
(CDbl(proc.PeakWorkingSet64).ToFileSize()))
AddItem(lvMemory, "Virtual Memory Size", _
(CDbl(proc.VirtualMemorySize64).ToFileSize()))
AddItem(lvMemory, "Working Set", _
(CDbl(proc.WorkingSet64).ToFileSize()))
lvMemory.Columns(0).AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent)
lvMemory.Columns(1).AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent)
End Sub
|