Luci memory status doesn't match free

I'm seeing the memory status on the luci-bootstrap theme report different values than free reports. Am I just missing something fundamental? Built from master at 921392e216

root@OpenWrt:/# free
              total        used        free      shared  buff/cache   available
Mem:         965988       24740      851512         440       89736      891532
Swap:        193196           0      193196
root@OpenWrt:/#

Kb vs Mb .. . ?

See, that doesn't explain the Used being reported as 5 times what free reports as used, or the cached vs buffered.

image

Edit: Let me clarify, I'm in the middle of tracking down a kernel memleak, which is already mis-reporting things under the 5.10+ kernel (5.4 is unaffected).. I just need to know what values I'm seeing are good, and if not, I won't rely on them (and just report it), but I wanted to make sure I wasn't just misreading it or not understanding the charts

True, didn't notice, perhaps the math is off...

I think buff/cache in free = buff + cache in openwrt, but I'm only guessing.

1 Like

Close enough it looks like.. True Used + Buff/Cache = Luci's Used. I don't know if this is intentional or a left-over of an older time, but I'll issue it.

Well, LuCI status page calls ubus system info...

Results from live router.

 OpenWrt SNAPSHOT, r19075-ed364cd4b0
 -----------------------------------------------------
root@router1:~# free
              total        used        free      shared  buff/cache   available
Mem:         474156      106832      332664        3200       34660      323832
Swap:             0           0           0

root@router1:~# ubus call system info
{
        "localtime": 1646955104,
        "uptime": 180796,
        "load": [
                2144,
                768,
                32
        ],
        "memory": {
                "total": 485535744,
                "free": 341303296,
                "shared": 3276800,
                "buffered": 53248,
                "available": 332255232,
                "cached": 28401664
        },
        "root": {
                "total": 75920,
                "free": 74804,
                "used": 1116,
                "avail": 70888
        },
        "tmp": {
                "total": 237076,
                "free": 233876,
                "used": 3200,
                "avail": 233876
        },
        "swap": {
                "total": 0,
                "free": 0
        }
}
root@OpenWrt:/# free && ubus call system info
              total        used        free      shared  buff/cache   available
Mem:         965988       25300      850936         440       89752      890968
Swap:        193196           0      193196
{
        "localtime": 1646948054,
        "uptime": 8805,
        "load": [
                352,
                928,
                0
        ],
        "memory": {
                "total": 989171712,
                "free": 871358464,
                "shared": 450560,
                "buffered": 22519808,
                "available": 912351232,
                "cached": 60690432
        },
        "root": {
                "total": 834816,
                "free": 693024,
                "used": 141792,
                "avail": 693024
        },
        "tmp": {
                "total": 482992,
                "free": 482552,
                "used": 440,
                "avail": 482552
        },
        "swap": {
                "total": 197832704,
                "free": 197832704
        }
}
root@OpenWrt:/#

Or actually Total - Free ...

...since this commit from PR https://github.com/openwrt/luci/pull/3694 ...

3 Likes

Thanks @hnyman - Then I'll just chalk this up to working as intended and stick to free. I appreciate the help from you and @frollic !

Yeah, source is your friend :wink:

I'll be honest.. luci scares me :laughing: I don't have a basic knowledge of whatever scripting language it uses.

Older apps & pages use "lua" language for processing most of the stuff on the server-side (router), but newer stuff mainly uses javascript (for processing at the client browser).

Both languages are pretty easy to read if you know general programming concepts, and generic basic/C/whatever syntax etc.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.