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

[macOS] active system memory is inaccurate #2406

Open
giampaolo opened this issue Apr 18, 2024 · 1 comment
Open

[macOS] active system memory is inaccurate #2406

giampaolo opened this issue Apr 18, 2024 · 1 comment

Comments

@giampaolo
Copy link
Owner

Recently I have often see this failure:

2024-04-17T15:58:08.9453710Z ======================================================================
2024-04-17T15:58:08.9454630Z FAIL: psutil.tests.test_osx.TestSystemAPIs.test_vmem_active
2024-04-17T15:58:08.9456300Z ----------------------------------------------------------------------
2024-04-17T15:58:08.9456970Z Traceback (most recent call last):
2024-04-17T15:58:08.9468720Z   File "/private/var/folders/c9/jqpw9nhs7jj7vm5185nyw05h0000gn/T/cibw-run-dez06mlf/cp311-macosx_x86_64/venv-test-x86_64/lib/python3.11/site-packages/psutil/tests/__init__.py", line 739, in wrapper
2024-04-17T15:58:08.9470640Z     raise exc  # noqa: PLE0704
2024-04-17T15:58:08.9471070Z     ^^^^^^^^^
2024-04-17T15:58:08.9472970Z   File "/private/var/folders/c9/jqpw9nhs7jj7vm5185nyw05h0000gn/T/cibw-run-dez06mlf/cp311-macosx_x86_64/venv-test-x86_64/lib/python3.11/site-packages/psutil/tests/__init__.py", line 731, in wrapper
2024-04-17T15:58:08.9475220Z     return fun(*args, **kwargs)
2024-04-17T15:58:08.9475660Z            ^^^^^^^^^^^^^^^^^^^^
2024-04-17T15:58:08.9476840Z   File "/Users/runner/work/psutil/psutil/psutil/tests/test_osx.py", line 154, in test_vmem_active
2024-04-17T15:58:08.9478120Z     self.assertAlmostEqual(psutil_val, vmstat_val, delta=TOLERANCE_SYS_MEM)
2024-04-17T15:58:08.9479200Z AssertionError: 2259693568 != 2308902912 within 20971520 delta (49209344 difference)

In this case the active memory reported by vm_stat is 46M bigger than what is reported by psutil. Note to self: check how either vm_stat or top calculates this.

@giampaolo
Copy link
Owner Author

Also free memory:

2024-04-18T06:42:07.3789370Z ======================================================================
2024-04-18T06:42:07.3789770Z FAIL: psutil.tests.test_osx.TestSystemAPIs.test_vmem_free
2024-04-18T06:42:07.3790360Z ----------------------------------------------------------------------
2024-04-18T06:42:07.3790710Z Traceback (most recent call last):
2024-04-18T06:42:07.3798740Z   File "/private/var/folders/z4/sx941vhj3jd2jb9_gwftzctc0000gn/T/cibw-run-l5yirtks/cp39-macosx_arm64/venv-test-arm64/lib/python3.9/site-packages/psutil/tests/__init__.py", line 739, in wrapper
2024-04-18T06:42:07.3799700Z     raise exc  # noqa: PLE0704
2024-04-18T06:42:07.3800720Z   File "/private/var/folders/z4/sx941vhj3jd2jb9_gwftzctc0000gn/T/cibw-run-l5yirtks/cp39-macosx_arm64/venv-test-arm64/lib/python3.9/site-packages/psutil/tests/__init__.py", line 731, in wrapper
2024-04-18T06:42:07.3801610Z     return fun(*args, **kwargs)
2024-04-18T06:42:07.3802160Z   File "/Users/runner/work/psutil/psutil/psutil/tests/test_osx.py", line 148, in test_vmem_free
2024-04-18T06:42:07.3802800Z     self.assertAlmostEqual(psutil_val, vmstat_val, delta=TOLERANCE_SYS_MEM)
2024-04-18T06:42:07.3803360Z AssertionError: 591855616 != 658292736 within 20971520 delta (66437120 difference)
2024-04-18T06:42:07.3803700Z 
2024-04-18T06:42:07.3803880Z ----------------------------------------------------------------------

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

No branches or pull requests

1 participant