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

"Used memory" displays a value larger than neofetch or free #117

Open
1 task done
delgh1 opened this issue Apr 24, 2023 · 4 comments
Open
1 task done

"Used memory" displays a value larger than neofetch or free #117

delgh1 opened this issue Apr 24, 2023 · 4 comments

Comments

@delgh1
Copy link

delgh1 commented Apr 24, 2023

Description

The "used memory" is way larger than it should be.
For example, both neofetch and free -h displays 290MiB-ish, but hyfetch says 900+MiB used

  • Does this issue still occur in the master branch? (Required if issue)

hyfetch:

Memory: 915.14 MiB / 64284.92 MiB

total used free shared buff/cache available
Mem: 62Gi 292Mi 62Gi 0.0Ki 339Mi 61Gi
Swap: 0B 0B 0B

Config file

~/.config/hyfetch.json
{"preset": "rainbow", "mode": "rgb", "light_dark": "dark", "lightness": 0.5, "color_align": {"mode": "horizontal", "custom_colors": [], "fore_back": null}, "backend": "neofetch", "distro": null}

@hykilpikonna
Copy link
Owner

The difference is due to the fact that HyFetch calculates used memory by calculating (total - available) for Linux kernel >3.14rc that provides available ram information. The original method calculates Memtotal + Shmem - MemFree - Buffers - Cached - SReclaimable

image_2023-04-27_08-53-46

For example, if I log the calculated memory used value calculated before and after the change, the new calculation outputs a value higher than the original. I don't know which method is more accurate though.

image

@delgh1
Copy link
Author

delgh1 commented Apr 28, 2023

Ah I see, thanks for the explanation. I was a little bit confused.
Personally speaking I would prefer hyfetch to display a value that's close to what free -h says, to avoid such confusion.

Let's keep this issue open for a while and see what other people in the community thinks.

@hykilpikonna
Copy link
Owner

Okay, I'll open a vote for this in case anyone stumble upon this thread.

Voting for Memory-Use Detection

  • Press ❤️ if you prefer the original calculation Total + Shmem - MemFree - Buffers - Cached - SReclaimable
  • Press 🚀 if you prefer the new calculation Total - Available

@fulalas
Copy link

fulalas commented Sep 1, 2023

Personally speaking I would prefer hyfetch to display a value that's close to what free -h says, to avoid such confusion.

You're asking the right solution to be reverted to the wrong one just because a random program decided to keep using the wrong solution. With all the respect, this shouldn't be considered. Your machine won't be consuming less memory if a given application says so.

Measuring memory consumption is not a subjective matter, and having your system freezing because you're trusting wrong information is anything but nice. The kernel is clearly the most reliable source of memory information, so the new approach implemented by @hykilpikonna is the one that should be used.

@hykilpikonna, thanks for implementing the right solution and giving people the right to vote (but let's stick with the right solution, hahaha). :)

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

3 participants