简体   繁体   English

如何在32位机器上识别超过4 GB的ram

[英]How to identify more than 4 gb ram on 32-bit machine

I know that a 32-bit OS cannot see more than 4 GB of RAM. 我知道32位操作系统看不到超过4 GB的RAM。
So if I were to install, say, 6 GB of RAM on a machine running 32-bit OS, is there any way to identify that? 因此,如果我要在运行32位操作系统的计算机上安装6 GB的RAM,有什么方法可以识别它吗?
I know one way to get the installed RAM is through WMI class: win32_physicalmemory.Capacity 我知道一种获取已安装RAM的方法是通过WMI类:win32_physicalmemory.Capacity
But I don't know if it'll show the correct installed ram size rather than supported. 但我不知道它是否会显示正确安装的柱塞尺寸而不是支持。
I don't have the setup to test this scenario, but if some one already knows this, please confirm. 我没有设置测试这种情况,但如果有人已经知道这一点,请确认。
Else, please let me know if there's some other way of doing the same. 否则,请告诉我是否有其他方法可以做同样的事情。 I'm asking this for any windows 32-bit OS. 我问这个任何Windows 32位操作系统。

Thanks in advance. 提前致谢。
Samrat Patil. 萨姆拉特帕蒂尔。

32bit operating systems CAN see more than 4GB of memory with PAE -enabled CPUs. 32位操作系统可以通过支持PAE的 CPU看到超过4GB的内存。 It's just that the 32bit address space is limited to 4GB. 只是32位地址空间限制为4GB。 But as the application has only access to its own virtual address space, it can't tell if some memory it allocated lays in 1st or 5th gigabyte of memory. 但是由于应用程序只能访问自己的虚拟地址空间,因此无法判断它分配的内存是存储在第1或第5 GB的内存中。

On windows, you can use the GetPhysicallyInstalledSystemMemory function: 在Windows上,您可以使用GetPhysicallyInstalledSystemMemory函数:

function retrieves the amount of physically installed RAM from the computer's SMBIOS firmware tables. 函数从计算机的SMBIOS固件表中检索物理安装的RAM量。 This can differ from the amount reported by the GlobalMemoryStatusEx function, which sets the ullTotalPhys member of the MEMORYSTATUSEX structure to the amount of physical memory that is available for the operating system to use. 这可能与GlobalMemoryStatusEx函数报告的数量不同,后者将MEMORYSTATUSEX结构的ullTotalPhys成员设置为可供操作系统使用的物理内存量。

Read more: http://www.geoffchappell.com/viewer.htm?doc=notes/windows/license/memory.htm 阅读更多: http//www.geoffchappell.com/viewer.htm?doc = notes / windows / license / memory.htm

WMI将所有内存大小报告为uint64Win32_OperatingSystem文档中所示

There is quite nice function GlobalMemoryStatusEx that should solve your problem. 有很好的功能GlobalMemoryStatusEx可以解决你的问题。 It gives back 它回馈

typedef struct _MEMORYSTATUSEX {
  DWORD     dwLength;
  DWORD     dwMemoryLoad;
  DWORDLONG ullTotalPhys;
  DWORDLONG ullAvailPhys;
  DWORDLONG ullTotalPageFile;
  DWORDLONG ullAvailPageFile;
  DWORDLONG ullTotalVirtual;
  DWORDLONG ullAvailVirtual;
  DWORDLONG ullAvailExtendedVirtual;
}MEMORYSTATUSEX, *LPMEMORYSTATUSEX;

I think you are looking for ullTotalPhys . 我想你正在寻找ullTotalPhys All values are in bytes. 所有值都以字节为单位。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM