hykilpikonna / hyfetch

🏳️‍🌈 🏳️‍⚧️ Neofetch with LGBTQ+ pride flags!
MIT License
1.24k stars 96 forks source link

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

Open delgh1 opened 1 year ago

delgh1 commented 1 year ago

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

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

Voting for Memory-Use Detection

fulalas commented 12 months ago

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). :)