Virtual memory
The
virtual memory is a contiguous space of memory (-addresses) that each
process sees. Usually, this space is larger than the available physical memory.
A 32-bit
process has a virtual address space of up to 4 GB, a 64-bit process up to 8 TB.
The order of addresses in virtual memory does not correspond to the order of addresses in the physical memory.
By default, the lower half of the virtual memory can be used for the data of a process while the upper half is used for Windows. (Only in 32-bit Windows?)
Each process has a
page table that maps a process's virtual memory to the physical memory or a page in the
paging file.
Because the available physical memory at times cannot cover all required access to virtual memory, the memory manager paging out and in parts of the virtual memory to disk.
Determining size of memory on the command line
On the command line (
cmd.exe
,
PowerShell), the size of the memory can be determined like so:
C:\> systeminfo | findstr /c:"Total Physical Memory"
The following
PowerShell command reports the total physical memory in gigabytes (rounded to one decimal place):
[math]::round( (get-computerInfo).csTotalPhysicalMemory / 1gb, 1 )
The amount of available memory can be determined with
(get-counter '\Memory\Available MBytes').counterSamples
(get-counter '\Memory\Available KBytes').counterSamples
wmic os get FreePhysicalMemory,FreeSpaceInPagingFiles,FreeVirtualMemory,MaxProcessMemorySize,TotalVirtualMemorySize,TotalVisibleMemorySize
Typeperf
With
typeperf.exe
, the amount of available memory (bytes) can be shown like so:
C:\> typeperf "\memory\Available Bytes" -sc 1
Other memory related performance counters can be listed with
typeperf -qx memory