Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: do not print correctly the unused memory value.(about issue#176) #183

Closed
zzustu opened this issue Apr 17, 2020 · 1 comment
Closed

Comments

@zzustu
Copy link

zzustu commented Apr 17, 2020

Wrong
OS: Windows Server 2019 Datacenter
total memory: 12GB
unused memory: 7.5GB (≈7GB)
but ghw print unused=total

memory (12GB physical, 12GB usable)

review fix issue#176 WQL

SELECT TotalVisibleMemorySize FROM Win32_OperatingSystem

You should use FreePhysicalMemory instead of TotalVisibleMemorySize,
picture from Microsoft WMI API website: https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-operatingsystem

TotalVisibleMemorySize (Units "kilobytes")
TotalVisibleMemorySize

FreePhysicalMemory (Units "kilobytes")
FreePhysicalMemory

@jaypipes
Copy link
Owner

Hi @zzustu. You have some confusion about what the MemoryInfo.TotalUsableBytes contains.

From the documentation:

ghw.MemoryInfo.TotalUsableBytes contains the amount of memory the system can actually use. Usable memory accounts for things like the kernel's resident memory size and some reserved system bits

For Windows, the amount of win32_OperatingSystem.TotalVisibleMemorySize field is equal to the total amount of memory that the system has available to it to use, which is what ghw.MemoryInfo.TotalUsableBytes represents.

The ghw.MemoryInfo.TotalPhysicalBytes amount, on the other hand, is the total amount of physical memory (in DIMMs) attached to the hardware. In Linux, this can be determined by looking at syslog startup messages. In Windows, I will need to determine this value by summing the amount of the Win32_MemoryBank WMI table records. I have this on my roadmap to tackle. Hope to get to it in the next month. You can see here for more discussion on this topic:

#171 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants