[Windows] psutil.swap_memory() show swap instead of committed memory #1927
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
fromPERFORMANCE_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.