-
-
Notifications
You must be signed in to change notification settings - Fork 635
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
"used memory" metric (not same as htop, etc) #291
Comments
Came here to report the same issue. Glad it's not just me. |
This comment was marked as spam.
This comment was marked as spam.
1 similar comment
This comment was marked as spam.
This comment was marked as spam.
Same here with btop 1.2.13 on Manjaro 23.0.4 showing 13.1GB whereas htop 1.56GB. |
This comment was marked as spam.
This comment was marked as spam.
This has already been discussed here
I agree that this is confusing since it doesn't align with the definition of |
I see no issue having alternative ways of calculating the mem usage. Btw, leaving comments saying only "+1", "me too" or variants thereof, really serves no purpose. @leaf-ts
I'm curious which one is right? Since none of the programs show the same "used memory" in your screenshot. |
So guess it depends what for ppl use this info. My case is if having e.g. 16GB of RAM installed, running OS etc. programs that take N GB of RAM already, can I run another prog that I know will need 4GB of memory. Currently I can't answer this question with |
Sure you can, look at the "available" memory, since you know... you wanna know how much memory you have available.
Me neither, and as answered above the calculation isn't based on cache and buffers. The current calculation for used memory is "total memory - available memory" and thus shows how much memory is in "active" use and can not immediately be freed. And you can already see a separate stat for how much memory is cached, so not sure why there would by any confusion there? |
You're right, I'm sorry, don't know how I missed diff stats for memory already.
So forgive me if this is sth obvious to you but it's not at all to me. Looking at the OP's pic, according to btop, he can't launch a prog that will take 4GB of memory without touching swap. But according to htop he can. |
The available memory metric is directly reported from the kernel and described as:
From https://man7.org/linux/man-pages/man5/proc.5.html But my mistake, this is only true for Linux. In OP's case on MacOS there is no "available" metric provided, so there is probably room for improvement in how the "used" (and also "available") memory is calculated. I will have to look it over the calculations for MacOs, maybe @joske have insights in to what the memory calculations for MacOs (and the BSD's) was based on. |
That solves my confusion, thank you very much for taking the time to ELI5 :) . Hope it can serve as future ref to others. |
It's absolutely not clear to me what these fields are supposed to mean. What is the difference between 'free' and 'available'? All OSes have different ways of accounting virtual memory, and expose a lot of details, but not clear how to map these to btop's 4 numbers. For macOS, the memory metrics come from:
Looking at https://opensource.apple.com/source/xnu/xnu-3789.51.2/osfmk/mach/vm_statistics.h.auto.html, it seems the |
But when you compare the 'cached' field with Activity Monitor, it seems to match the value of |
Should be fixed for MaxOS in latest commit. The issue seemed to be that we were counting inactive memory for MacOS, which we don't for the BSD's. Now the used metric seems to be the same as in htop. |
What about BSD? You closed issue #728 as a duplicate of this. But there is no fix for BSD. |
@ivan-volnov My bad by making the assumption that would be right for BSD too, will have to investigate. |
Hello,
Describe the bug
btop shows wrong memory used metric.
It worked fine but I think this happened after the upgrade to MacOS 12.3, although I cannot be sure 100% this is the cause.
To Reproduce
just run btop. not additional steps required
Screenshots
In Activity monitor, asitop and htop the used memory show to be ~17GB
btop shows ~30GB. It looks like it also calculates the cached files? I am not sure.
screenshot below
Info (please complete the following information):
Additional context
contents of
~/.config/btop/btop.log
log is filled with similar errors like the below
The text was updated successfully, but these errors were encountered: