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] psutil.swap_memory() show swap instead of committed memory #1927

Merged
merged 1 commit into from
Apr 8, 2021

Conversation

davidkna
Copy link
Contributor

Summary

Description

.ullTotalPageFile and .ullAvailPageFile include both the swap and physical memory so in order to get the correct swap memory values the physical memory size/usage needs to be subtracted.

https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-memorystatusex

.ullTotalPageFile is "The current committed memory limit". It mirrors the value of .CommitLimit * .PageSize from PERFORMANCE_INFORMATION "The current maximum number of pages that can be committed by the system without extending the paging file". I think this confirms the value refers to committed or total system memory including both the pagefile and hardware memory.

.ullAvailPageFile - .ullAvailPhys also aligns with the value Windows reports for the page file size in the UI for me.

@davidkna davidkna force-pushed the fix-win-swap branch 3 times, most recently from 2bf3e7c to e166a62 Compare March 14, 2021 11:01
Signed-off-by: David Knaack <davidkna@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

[Windows] psutil.swap_memory() shows committed memory instead of swap
3 participants