MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

Raspberry Pi Memory Loss

  • Hi not sure if anyone else with a pi has noticed but the longer the Magic Mirror runs the more ram it uses for exactly the same thing it started up with, ie start up MagicMirror and I have 80% memory free four hours later and it’s 78% still not bad but a day later then it’s 58% memory free. This is on a Pi 4 with 4Gb of ram so I’m not sure how all the other Pi’s and other mirrors are doing but it seems to tear up a lot of memory. Anyone able to offer any help in this area?

  • @dazza120

    how do you determine free memory?
    With the later Linux distros it becomes easy to jump to wrong conclusions and there are several settings involved. that can influence it.

  • @evroom I’m using mmm-SystemStats to view it on the magic mirror, unless this is monitoring the memory wrong?

  • @dazza120
    This modules uses the free command to determine memory usage.
    It does free / total times 100 %.
    But free (the value) does not take into account the shared memory, cache and buffers used by the system.
    It would be better to use the available value.
    This value tells you how much memory is available to start a new application.
    See man free for some more details.

    Modern Linux is making more and more advanced use of memory and swap techniques, making it more and more difficult to determine certain values.

  • @evroom
    In node_helper.js you could change line 67.
    Change $4 into $7.
    Then observe if you see the same behavior.

  • @evroom changed it thanks I’ll continue the test much appreciated

  • @evroom hi it’s still declining but a lot slower, I’ll let it continue and see if the mirror locks up if it reaches 0%

  • @evroom yeah it just died, MagicMirror crashed showing the black screen, when MacicMirror was restarted boom 80% free memory. So now I’ve got watchdog on for hopefully when it crashes it will restart with 80% memory

  • Have you tried running top or (htop if installed) from a terminal cli to see which process(es) are using up the memory?

  • @dazza120

    Could you send the output of the following commands, when running more or less normal?

    swapon -s
    vmstat 5 10
    top -b -o +%MEM | head -n 22

    And the suggested htop command is also nice to look at.
    Might need to be installed separately.

Log in to reply