Kodi / System info / Summary / Free memory value too optimistic?

  • Probably it's not a bug in fact but a feature more likely. But the question is if it shouldn't be changed a bit.

    In several most fresh LE 9.80 Nightly test builds on my RPi 4B / 2GB I have experienced several unexpected crashes due to Out of memory event when oom-kill intervened.

    That's due to my Timeshift settings in Tvhedadend to use RAM only with Maximum RAM size set to 1024 MB. This limit I set in past experimentally by observing the Free memory value in Kodi / System info / Summary. So now after crashes it seemed that LE is using more RAM and I'l had to decrease the Maximum RAM size to avoid Out of memory.

    But I have found that the Free memory value is calculated and it is somewhat greater than free / avail Mem values reported by the top app.

    It looks that Free memory formula is Mem total - Mem used but this value is greater than Mem free / avail Mem reported by top so there's an overhead somewhere.

    This may be misleading as I would expect the Free memory in Kodi should display the lowest - real - value.

    I wonder why the Free memory is calculated by formula and why it does not show the free or avail Mem value instead? I suppose there's a reason but shouldn't be that changed?

  • Nobody commented it so far but I would like to know if it's really OK how the Free memory in Kodi is reported?

    It's still the same in latest LE 10 Nightly and to me it looks confusing.

    For instance:

    1)

    Kodi - System info - Summary

    Free memory: 1360MB

    top in SSH console:

    top - 21:29:55 up 4:12, 1 user, load average: 1.17, 1.36, 1.42

    Tasks: 144 total, 1 running, 143 sleeping, 0 stopped, 0 zombie

    %Cpu(s): 9.2 us, 4.1 sy, 0.3 ni, 85.3 id, 0.0 wa, 0.0 hi, 1.1 si, 0.0 st

    MiB Mem : 1863.3 total, 462.7 free, 503.5 used, 897.0 buff/cache

    MiB Swap: 0.0 total, 0.0 free, 0.0 used. 614.3 avail Mem

    2)

    Kodi - System info - Summary

    Free memory: 1303MB

    top in SSH console:

    top - 22:32:01 up 5:14, 3 users, load average: 1.44, 1.38, 1.39

    Tasks: 148 total, 1 running, 147 sleeping, 0 stopped, 0 zombie

    %Cpu(s): 6.9 us, 4.0 sy, 0.3 ni, 87.7 id, 0.0 wa, 0.0 hi, 1.1 si, 0.0 st

    MiB Mem : 1863.3 total, 225.1 free, 553.4 used, 1084.8 buff/cache

    MiB Swap: 0.0 total, 0.0 free, 0.0 used. 348.5 avail Mem

  • Thanks for a comment. I still don't understand why Kodi shows such an unusually high value of free memory.

    It was always strange but as soon as I have created a tmpfs filesystem in RAM which is now occupied by about 800 MB of Timeshift buffer data, the Kodi's report regarding to Free memory is now absolutely nonsense on my RPi 4B / 2GB RAM.

    That's why I am asking if developers (who can better than me understand how things work) are considering it as OK... Maybe it's not just a GUI info message - if the same value is used somewhere in Kodi's background, it could perhaps sometimes lead to memory overflow etc (and the oom killer sometimes appears...)...


    FYI the current values:

    Kodi Free memory: 1424MB

    top - 10:39:55 up 17:22, 3 users, load average: 1.26, 1.43, 1.45

    Tasks: 148 total, 1 running, 147 sleeping, 0 stopped, 0 zombie

    %Cpu(s): 8.6 us, 3.5 sy, 0.1 ni, 87.3 id, 0.0 wa, 0.0 hi, 0.5 si, 0.0 st

    MiB Mem : 1863.3 total, 386.9 free, 438.9 used, 1037.5 buff/cache

    MiB Swap: 0.0 total, 0.0 free, 0.0 used. 529.9 avail Mem

    # cat /proc/meminfo

    MemTotal: 1908012 kB

    MemFree: 395616 kB

    MemAvailable: 542032 kB

    Buffers: 45152 kB

    Cached: 990108 kB

    SwapCached: 0 kB

    Active: 791468 kB

    Inactive: 486616 kB

    Active(anon): 634920 kB

    Inactive(anon): 405900 kB

    Active(file): 156548 kB

    Inactive(file): 80716 kB

    Unevictable: 45036 kB

    Mlocked: 0 kB

    HighTotal: 1231872 kB

    HighFree: 30896 kB

    LowTotal: 676140 kB

    LowFree: 364720 kB

    SwapTotal: 0 kB

    SwapFree: 0 kB

    Dirty: 0 kB

    Writeback: 0 kB

    AnonPages: 288024 kB

    Mapped: 108004 kB

    Shmem: 797996 kB

    KReclaimable: 27780 kB

    Slab: 59440 kB

    SReclaimable: 27780 kB

    SUnreclaim: 31660 kB

    KernelStack: 1888 kB

    PageTables: 3128 kB

    NFS_Unstable: 0 kB

    Bounce: 0 kB

    WritebackTmp: 0 kB

    CommitLimit: 954004 kB

    Committed_AS: 1548760 kB

    VmallocTotal: 245760 kB

    VmallocUsed: 12216 kB

    VmallocChunk: 0 kB

    Percpu: 512 kB

    CmaTotal: 524288 kB

    CmaFree: 320136 kB

    Edited 4 times, last by ghtester (March 27, 2021 at 10:02 AM).