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: get swap usage from the pagefile(s) #2161

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

giampaolo
Copy link
Owner

@giampaolo giampaolo commented Oct 21, 2022

Summary

Description

See discussion in #2074. With this I'm able to get the same values I get by running %windir%\system32\SystemPropertiesPerformance.exe, see https://superuser.com/a/858899

@giampaolo giampaolo changed the title Win swap usage via pagefiles Windows: get swap usage from the pagefile(s) Oct 21, 2022
@Danstiv
Copy link

Danstiv commented Oct 21, 2022

>>> psutil.swap_memory()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python310\lib\site-packages\psutil-5.9.4-py3.10-win32.egg\psutil\__init__.py", line 1987, in swap_memory
    return _psplatform.swap_memory()
  File "C:\Python310\lib\site-packages\psutil-5.9.4-py3.10-win32.egg\psutil\_pswindows.py", line 245, in swap_memory
    pagefiles = cext.disk_swaps()
OSError: [WinError 998] Неверная попытка доступа к адресу памяти: '(originated from NtQuerySystemInformation)'

@giampaolo
Copy link
Owner Author

giampaolo commented Oct 21, 2022

OSError: [WinError 998] Неверная попытка доступа к адресу памяти: '(originated from NtQuerySystemInformation)'

Ouch! Note to self: that means ERROR_NOACCESS -> "Invalid attempt to access a memory address".

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

Successfully merging this pull request may close these issues.

[Windows] Swap used is bigger than swap total
2 participants