On Sun, Aug 3, 2025 at 6:51 PM drkhsh <me_AT_drkhsh.at> wrote:
>
> i had a look at multiple implementations of free and read the relevant
> parts of top/htop/btop/and co, which lead me to the current
> implementation.
>
> is there any situation where the values differ?
>
> thanks
>
> On Mon, Jul 28, 2025 at 08:09:41AM -0400, Steve Ward wrote:
> > Linux free(1) calculates used memory as MemTotal minus MemAvailable.
> >
> > https://gitlab.com/procps-ng/procps/-/commit/2184e90d2e7cdb582f9a5b706b47015e56707e4d
>
On Linux top, free, btop, neofetch, and fastfetch use the "MemTotal -
MemAvailable" approach. htop is the outlier.
https://gitlab.com/procps-ng/procps/-/issues/292
"The consensus reached was simply: used = MemTotal - MemAvailable."
free, top:
https://gitlab.com/procps-ng/procps/-/blob/master/library/meminfo.c?ref_type=heads#L736
btop: ttps://github.com/aristocratos/btop/blob/a05192fc4aa329c9bdc0ff77896a96d457ac42c3/src/linux/btop_collect.cpp#L1923
neofetch:
https://github.com/dylanaraps/neofetch/blob/master/neofetch#L2698
fastfetch:
https://github.com/fastfetch-cli/fastfetch/blob/dev/src/detection/memory/memory_linux.c#L52
htop issue:
https://github.com/htop-dev/htop/issues/1307
Received on Tue Aug 05 2025 - 16:44:05 CEST