Stanislav Kozina, Ersin <xersin@users.sf.net>
Mamoru TASAKA <mtasaka@fedoraproject.org>
number Zero <numzero@users.sf.net>
+ Carles Pina i Estany <carles@pina.cat>
[History]
LXPanel is a derivative work from fbpanel [1] written by Anatoly Asviyan,
* Fixed crash on right-click task button after some task was killed using menu
on another task button.
* Fixed crash after color was removed from monitor plugin configuration.
+* Aligned used memory calculation in lxpanel monitor with 'free' command line
+ utility.
0.9.3
-------------------------------------------------------------------------
* 2014-2016 Andriy Grytsenko <andrej@rep.kiev.ua>
* 2015 Rafał Mużyło <galtgendo@gmail.com>
* 2018 Mamoru TASAKA <mtasaka@fedoraproject.org>
+ * 2019 Carles Pina i Estany <carles@pina.cat>
*
* <terms>
* Copyright (c) 2008-2014 LxDE Developers, see the file AUTHORS for details.
long int mem_free = 0;
long int mem_buffers = 0;
long int mem_cached = 0;
- unsigned int readmask = 0x8 | 0x4 | 0x2 | 0x1;
+ long int mem_sreclaimable = 0;
+ unsigned int readmask = 0x10 | 0x8 | 0x4 | 0x2 | 0x1;
if (!m->stats || !m->pixmap)
RET(TRUE);
readmask ^= 0x8;
continue;
}
+ if (sscanf(buf, "SReclaimable: %ld kB\n", &mem_sreclaimable) == 1) {
+ readmask ^= 0x10;
+ continue;
+ }
}
fclose(meminfo);
* 'free', because it can be flushed fairly quickly, and generally
* isn't necessary to keep in memory.
* It is hard to draw the line, which caches should be counted as free,
- * and which not. Pagecaches, dentry, and inode caches are quickly
- * filled up again for almost any use case. Hence I would not count
- * them as 'free'.
+ * and which not. 'free' command line utility from procps counts
+ * SReclaimable as free so it's counted it here as well (note that
+ * 'man free' doesn't specify this)
* 'mem_cached' definitely counts as 'free' because it is immediately
* released should any application need it. */
m->stats[m->ring_cursor] = (mem_total - mem_buffers - mem_free -
- mem_cached) / (float)mem_total;
+ mem_cached - mem_sreclaimable) / (float)mem_total;
m->ring_cursor++;
if (m->ring_cursor >= m->pixmap_width)