Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Shows incorrect usage of RAM #90

Closed
uchihamalolan opened this issue Nov 18, 2020 · 8 comments
Closed

Shows incorrect usage of RAM #90

uchihamalolan opened this issue Nov 18, 2020 · 8 comments

Comments

@uchihamalolan
Copy link

uchihamalolan commented Nov 18, 2020

I ran pfetch and top to compare RAM consumption data and pfetch is very much off the mark.

Result from running top:

MiB Mem : 1970.8 total, 1551.6 free, 106.5 used, 312.6 buff/cache

Result from running pfetch:

       /\         os     Arch Linux
     /\   \       host   VirtualBox 1.2
    /      \      kernel 5.9.8-arch1-1
   /   ,,   \     uptime 4h 33m
  /   |  |  -\    pkgs   256
 /_-''    ''-_\   memory 250M / 1970M

@dylanaraps
Copy link
Owner

dylanaraps commented Nov 18, 2020

How are you certain that pfetch is wrong here and top isn't incorrect? pfetch calculates memory in the same way as neofetch, screenfetch, conky, htop, archey4, etc, etc. If there is indeed a bug I'm happy to look into it, we just need to figure out where the correctness lies.

See:

Anyway, I'll do some digging.

@dylanaraps
Copy link
Owner

dylanaraps commented Nov 18, 2020

All of this being said, on kernels post 2014 (34e431b0ae398fc54ea69ff85ec700722c9da773) neofetch/pfetch will use MemAvailable for used memory instead of calculating the value. Only when this field is absent will the used memory calculation be done.

@dylanaraps
Copy link
Owner

Related: htop-dev/htop#281

Author of issue claims the used memory allocation is inaccurate stating that MemAvailable is what should be used

@uchihamalolan
Copy link
Author

All of this being said, on kernels post 2014 (34e431b0ae398fc54ea69ff85ec700722c9da773) neofetch/pfetch will use MemAvailable for used memory instead of calculating the value. Only when this field is absent will the used memory calculation be done.

I ran both pfetch and neofetch. but the mem consumed info there differs.
could you check?

pfetch: memory 431M / 3917M
neofetch: Memory: 225MiB / 3917MiB

@uchihamalolan
Copy link
Author

I manually calculated with both formulas (from /proc/meminfo).
when I use the formula with MemAvailable the pfetch information is correct. The output from neofetch that I shared in the previous comment is result of using the older formula, which gives much lower memory consumption (I guess it would seem a small difference when memory consumption is around 2-3 Gigs). same could be said for htop

@dylanaraps
Copy link
Owner

Are you trying with latest master for both pfetch and neofetch? The MemAvailable addition is new for both (and not yet in a release).

@uchihamalolan
Copy link
Author

@dylanaraps
Yes you're correct, neofetch code does not have MemAvailable addition. I installed neofetch using pacman. (Meanwhile pfetch is built from source, hence latest code was available) That explains it then I guess.

@dylanaraps
Copy link
Owner

Yeah. Will make new releases of both shortly. Closing this as it's been solved. :)

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

No branches or pull requests

2 participants