fix virtual_memory computation on windows in refresh_pids #1308
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.
Following #1299, I started
using
refresh_pids_specifics
to avoid the macOS cpu usage computation bug.However, this change brought another bug, where the virtual_memory field
of a process returns 2TB of ram when first refreshed.
When refreshing a process' memory usage, we use
WorkingSetSize
formemory
andPrivateUsage
forvirtual_memory
.However, when calling
refresh_pids
, another codepath refreshes thosevalues, and use
VirtualBytes
forvirtual_memory
. This is not theright field and is generally equal to 2TB, making this measurement
completely wrong.
The fix is to use the same field as when refreshing a single process,
PrivatePageCount
(which afaict reading the documentation, should bethe same thing as
PrivateUsage
).I tested it on the 0.30 branch and it fixed the bug.
I targeted master as i'm ensure what your stable releases process is like,
but I would really appreciate a backport and a new 0.30 release with this
bugfix if possible. Thanks!