~lubuntu-dev/lxde/lxpanel

Viewing all changes in revision 1890.

  • Committer: Andriy Grytsenko
  • Author(s): Carles Pina i Estany
  • Date: 2019-01-13 21:45:12 UTC
  • Revision ID: git-v1:370382d36ac4e2ecc45776eec9b607ec684a3057
Aligns used memory in lxpanel monitor with free command line utility.

It counts SReclaimable as free.

This is consistent with "free -m" output.

Note that "man free" says:
used   Used memory (calculated as total - free - buffers - cache)

Which is similar to what plugins/monitors.c used to do. But this didn't
match the output of "free -m" (which is confusing) and the source code
of free is counting SReclaimable as "free" (see
procps-3.3.12/proc/sysinfo.c around line 707:
kb_main_cached = kb_page_cache + kb_slab_reclaimable;

And calcuating the mem_used like:
mem_used = kb_main_total - kb_main_free - kb_main_cached - kb_main_buffers;

With this patch lxpanel monitor is consistent with free.

procps "free" suggests that SReclaimable was added in the Kernel 2.6.19.
It was released in 2006, if this field doesn't exist the memory monitor
displays "0" (and a warning by lxpanel is displayed on the console).

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: