-
-
Notifications
You must be signed in to change notification settings - Fork 644
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
[BUG] Twice the reported RAM usage than htop #161
Comments
It looks like free calculates the used memory differently than btop. btop calculates see https://gitlab.com/procps-ng/procps/-/blob/newlib/proc/meminfo.c#L702 htop and top both seem to follow the free implementation as all three programs report the same value for used. I wrote a fix which follows the free implementation but it seems to be still off by a few hundred MiB. The question really is which definition of used the code should follow. A change would cause Used: and Availabe: not to add up to Total: and 100% anymore. |
@ChUnterberger I'm not convinced the calculation should change without knowing the reasoning for how it's calculated in free, htop etc. |
@aristocratos Thank you for your input According to this https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773 MemAvailable is an estimate of how much memory a process could allocate without swapping. I am sure it includes MemFree. MemUsed is a really just a question of definition and expectation and likely for this reason not defined in /proc/meminfo at all. If you are very strict with your definitiion then you would have to say The free implementation predates MemAvailable and therefore the developers had to come up with a definition of used. and btop chose I can live with either of the definitions but i agree that the current implementation best shows to a user how much main memory is used and cannot be reclaimed easily. The issue is just the expectation other programs like free, htop and top cause when they will be inevitable compared against btop. @sukulent If you agree with this, then i would suggest to close the issue. |
Thanks for the explanation, I learned something today! |
I am seeing ~twice the reported used RAM than htop or free reports.
I would expect it to read the same.
Is this expected behavior?
The text was updated successfully, but these errors were encountered: