Kodi.bin memory usage grows and grows until crash on RPi3B

  • Been having this issue ever since upgrading to Leia on my RPi3B IIRC, currently on LibreElec 9.2.0. The problem I'm facing is that the memory usage of kodi.bin just grows and grows until system becomes unresponsive. Starts out at about ~530MB free on a fresh boot and then increases at a rate of about 50-70MB / day (it's not perfectly linear). After a week or so memory usage is close to 100% and everything grinds to a halt. Manually rebooting once a week is not the end of the world, but I then lose sync with HomeAssistant (which has been a bug since forever) and it's just an annoyance overall.

    I don't feel like this is normal behaviour but I don't know how to troubleshoot it. Does anyone else experience this?

  • Test the memory usage after adding

    Code
    MALLOC_ARENA_MAX=1

    to /storage/config/kodi.conf.

    This could help if it's a memory fragmentation issue.

  • Test the memory usage after adding

    Code
    MALLOC_ARENA_MAX=1

    to /storage/config/kodi.conf.

    This could help if it's a memory fragmentation issue.

    Doesn't seem to make a difference unfortunately. I added it to /run/libreelec/kodi.conf as there was no kodi.conf in that location, maybe that assumption was wrong?

    70% of our userbase has an RPi3 or RPi2 so if there was a general issue we'd know about it. From past experience .. start uninstalling add-ons until you find the one causing the problem.

    I've tried disabling everything third party (I think ... I only have Twitch, YouTube, inputstream.adaptive and a skin installed but they have some dependencies) but made no difference. Doing anything, just playing a video file from a network source for example, slowly increases RAM usage. Doing things like updating the library takes a bigger chunk in one go. Doesn't seem like RAM is ever cleared. Usage only goes up, never down. So when updating the library takes a chunk of RAM it seems that chunk is reserved until Kodi is restarted.

  • Something is unusual in you setup. As chewitt mentioned RPix is our main user base, so it's NOT normal

    1) For the MALLOC test create the file /storage/config/kodi.conf.

    2) Don't assume that RAM will decrease. Linux uses as much ram as it can as a cache only releasing unused data when needed.

    3) Try adding a swapfile (Shouldn't be necessary) [How To]

    Please provide a full debug log.

    How to post a log (wiki)

    1. Enable debugging in Settings>System Settings>Logging
    2. Restart Kodi
    3. Replicate the problem
    4. Generate a log URL (do not post/upload logs to the forum)

    use "Settings > LibreELEC > System > Paste system logs" or run "pastekodi" over SSH, then post the URL link