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

[NetBSD] available virtual memory is higher than total #2231

Closed
giampaolo opened this issue Apr 13, 2023 · 0 comments · Fixed by #2233
Closed

[NetBSD] available virtual memory is higher than total #2231

giampaolo opened this issue Apr 13, 2023 · 0 comments · Fixed by #2233

Comments

@giampaolo
Copy link
Owner

======================================================================
FAIL: psutil.tests.test_system.TestMemoryAPIs.test_virtual_memory
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vagrant/psutil/psutil/tests/test_system.py", line 275, in test_virtual_memory
    assert 0 <= mem.percent <= 100, mem
           ^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: svmem(total=1019899904, available=1046573056, percent=-2.6, used=603414528, free=545050624, active=234807296, inactive=133210112, buffers=260288512, cached=368312320, shared=0, wired=294912)

TODO: check how zabbix calculates avail mem: https://github.com/zabbix/zabbix/blob/af5e0f80253e585ca7082ca6bc9cc07400afe2a7/src/libs/zbxsysinfo/netbsd/memory.c

giampaolo added a commit that referenced this issue Apr 13, 2023
On NetBSD "available" memory can be higher than "total". From now now calculate it exactly the same as Zabbix:
https://github.com/zabbix/zabbix/blob/af5e0f80253e585ca7082ca6bc9cc07400afe2a7/src/libs/zbxsysinfo/netbsd/memory.c

Fixes #2231 which produced this failure:

```
======================================================================
FAIL: psutil.tests.test_system.TestMemoryAPIs.test_virtual_memory
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vagrant/psutil/psutil/tests/test_system.py", line 275, in test_virtual_memory
    assert 0 <= mem.percent <= 100, mem
           ^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: svmem(total=1019899904, available=1046573056, percent=-2.6, used=603414528, free=545050624, active=234807296, inactive=133210112, buffers=260288512, cached=368312320, shared=0, wired=294912)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant