Why is FreePhysicalMemory giving the wrong value?

I am trying to use the FreePhysicalMemory property from win32_OperatingSystem class. The problem is that it usually only returns a few MB. It’s clear that I have more memory available for me, given the fact that only Powershell is open on my computer.

I am using the following code:

$test = gwmi win32_OperatingSystem
$test.FreePhysicalMemory

Am I doing something wrong? Or I don’t understand what the FreePhysicalMemory property returns?

Thanks for the help.

+3
source share
2 answers

Can you provide more information, such as your operating system, what is your total physical memory and the actual output of the PowerShell command?

, win32_OperatingSystem, , FreePhysicalMemory FreeVirtualMemory , , 1024.

, 4 (32- WinXP - OS ~ 3,5 ), PowerShell:

$test = gwmi win32_OperatingSystem
# verify the "visible" memory size to the Operating System
$test.TotalVisibleMemorySize
3652840

# check free memory
$test.FreePhysicalMemory
1872828

# divide by 1024 twice, once for KB -> MB, once for MB -> GB
($test.FreePhysicalMemory / 1024) / 1024
1.78606796264648

, , 1,786 . , Win7 x64.

MSDN WMI Win32_OperatingSystem: http://msdn.microsoft.com/en-us/library/aa394239.aspx

+5

, Vista ? , prefetcher, , .

- . , , .

0

All Articles