The total physical memory on a computer is displayed in several components of the user interface (UI) in Windows Vista and in Windows Server 2008. Each component reports a slightly different value. This article discusses why different components report slightly different values. Additionally, this article identifies the component that shows the most accurate value. It also contains information about the application programming interface (API) that retrieves the most accurate value.
Important Windows Vista Service Pack 1 (SP1) made changes to the way components of the user interface report memory.
For more information about how memory is reported in Windows Vista Service Pack 1, click the following article number to view the article in the Microsoft Knowledge Base:
946003 Windows Vista Service Pack 1 will report 4 GB of system memory (RAM) on systems that have 4 GB of memory installed
The components of the UI that report the total physical memory on the computer include the following:
The Welcome Center item in Control Panel
The System item in Control Panel
The Performance tab of Task Manager
The "View and print details" page of the Performance Information and Tools item in Control Panel
The Microsoft System Information (Msinfo32.exe) tool
The WinVer (Winver.exe) tool
The DirectX Diagnostic (Dxdiag.exe) tool
Each component reports a slightly different amount of total RAM that is available on the computer. This behavior occurs because some components were designed to display a consumer-friendly amount of RAM. Additionally, each component was developed by different teams at different times for a particular purpose.
For example, you may experience the following scenario when you view the following components on a Windows Vista-based computer:
The Welcome Center item in Control Panel reports 2.00 GB of RAM
The System item in Control Panel reports 2046 MB of RAM
The Performance tab of Task Manager reports 2045 MB of RAM
The "View and print details" page of the Performance Information and Tools item in Control Panel reports 2.00 GB of RAM
The System Information tool reports 2,045.54 MB of RAM
The WinVer tool reports 2,094,856 KB of RAM
The DirectX Diagnostic tool reports 2046 MB of RAM
Of these components, the System Information tool reports the most accurate value for total physical memory.
The System Information tool reports physical memory in several different ways:
Installed Physical Memory (RAM): This displays the total physical RAM installed on the system.
Total Physical Memory: This displays the total amount of memory that Windows is using. This may differ from "Installed Physical Memory." Depending on the memory configuration and the specific operating system that is installed, the operating system may be unable to use all the physical memory that is installed.
For example, if the system's memory controller can perform advanced memory protection techniques, the memory controller may reserve some memory for mirroring or for other fault-tolerance features. In other cases, Windows may be unable to use all the physical memory that is installed because of architectural or licensing limitations. Be aware that the version of the System Information tool that was included with Windows Server 2008 and in Windows Vista Service Pack 1 contained a problem that would cause "Total Physical Memory" to be misreported on systems with over 4 GB of total physical memory.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
950233 The Microsoft System Information (Msinfo32.exe) tool reports the incorrect amount of physical memory in a Windows Server 2008-based or Windows Vista Service Pack 1-based computer that has more than 4 GB of physical memory installed
Available Physical Memory: This is how much physical memory that is currently available (Memory that is not being used).
How to use the API to obtain the total physical memory value
To retrieve the most accurate value that is under program control, developers should follow these steps:
Call the GlobalMemoryStatusEx function.
Query the ullAvailPhys member of the MEMORYSTATUSEX structure.
The components use either the GlobalMemoryStatusEx function or the same kernel technique that is used by the GlobalMemoryStatusEx function to calculate the total physical memory on a computer. To programmatically obtain this value, query the ullAvailPhys member of the MEMORYSTATUSEX structure passed as input to the GlobalMemoryStatusEx function.
The GlobalMemoryStatusEx function was not available at the time that some components were built. However, all components calculate the physical memory on the computer in the same manner. The only difference among the components is the rounding that occurs before the total physical memory is displayed in the UI.
For more information about the GlobalMemoryStatusEx function, visit the following Microsoft Web site:
http://msdn2.microsoft.com/en-us/library/aa366589.aspxFor more information about the MEMORYSTATUSEX structure, visit the following Microsoft Web site:
http://msdn2.microsoft.com/en-us/library/aa366770.aspx For more information about memory size reporting on Windows Vista-based computers that have 4 GB of RAM installed, click the following article number to view the article in the Microsoft Knowledge Base:
929605 The system memory that is reported in the System Information dialog box in Windows Vista is less than you expect if 4 GB of RAM is installed