Memory Leak / Increasing Memory Usage

Hey everyone,

I have a perplexing issue with OSMC on my RPi 3B+. There seems to be a memory leak which leads to increasing memory use corresponding to the number of “things” on it that I’ve done (it seems somewhat more independent of the amount of time that has elapsed). As an example, upon boot it starts around 26% memory used and eventually settles at about 32%. If I start a random movie, bounce around a bit and then stop/exit back to the home screen, it climbs to the high 30’s/low 40’s. If I start a second movie, bounce around a bit and then stop/exit back the the home screen, it climbs again to the low 50’s. If I then start up any random video on the youtube app, then stop and exit back to the main menu it climbs to about 60%. I have seen it go as high as 75% - though eventually OSMC will give me the “sad face” crash and restart. Its to the point where I’ve created a task in Cron to restart the RPi every morning at 5am.

I don’t have very many add-ons installed. They are:
Embuary Helper
Embuary Info
HGTV
Library Data Provider
TED Talks
Youtube
Pandoki
Samba
SSH

My content is attached locally via USB and my network connection is via ethernet (not wireless).

My debug log is:
https://paste.osmc.tv/umihecidiq

or possibly:

https://paste.osmc.tv/ umihecidiq

Thanks

EDIT: when I click the first link above, it just shows me the log was created on “X” date/time. Not sure if you guys can see it in the background. I do have a text file of the complete log that I can see but I’m not sure how to post it in

EDIT 2: I pasted the log up in github https://github.com/sarvab/OSMC-memory-leak-2020-02-10/blob/master/.github/workflows/log.yml

Could you try disabling the addons too see if the mem leak occurs then ?

Hi Toast,

It does occur, but not as badly. After disabling all the video addons + pandoki, booting leaves it about 29%, then starting one movie and going back to main menu leaves it about 39%-40%. Starting another movie raises it to ~42%. Starting movies after that point doesn’t have any effect.

I remember with the ~July/August 2018 build of OSMC there wasn’t this issue - it all seems to have started along with the new build of OSMC when I installed it (Kodi v 18.5 - compiled on 2019-11-07)

Since you’re are able to reproduce it at will if I understand your initial post correctly, could you try this with the OSMC skin instead of the current used aeon.nox.silvo?

Take into account that Linux will use available memory for buffers/cache and free it.
How do you measure memory utilization?

OK, so I used the OSMC skin and turned on the debug log so I could see the free memory in the corner of the screen. These were the values that I got:

Booting the RPi and letting everything settle down: 609xxx/763xxx = 20% used

Starting a random movie, skipping around a bit, stopping, and exiting back to main menu reduced it to 540xxx/763xxx = 29% used

Starting something in YouTube addon, and stopping, allowing screen saver to start and stopping, reduced to 531xxx/763xxx = 30% used.

From that point, the values were stable, or rather, they would dip while something was happening but upon stopping playback and just letting the RPi idle, would go back to around the 531xxx value.

It does seem like the Aeon Nox Silvo skin is at least partly responsible for this but I’m not sure where that might be. Worth noting that a fresh boot with the OSMC skin would result in about 20% memory used and a fresh boot with the Aeon Nox Silvo screen would use about 29-30%…which seems right to me since that skin is way more resource intensive. But beyond that point the skin does seem to be contributing to the memory leak somehow.

EDIT: After coming home from work, I played with it some more. Starting a random tv show, skipping around, and going back to main menu now shows memory at 445xxx/763xxx, or about 42% used. So yeah, while the different skin helps the problem it seems like the memory leak is still there somewhere and seems mostly use dependent

I’ve been looking into something similar.

I’ve noticed that on the musicvisualization screen, on skins which put fantart in the background, every time the fanart changes (for example by playing a song by a different artist) the memory grows by a few Mb, and that memory is not returned when the song stops. Using a plugin such as artist-slideshow really exasperates the problem. seems that about 3-4 artists (or fanart backgounds) adds up to 0.1% to 0.2% of memory disappearing on mine.

After a few dozen artists kodi.bin eventually goes from the original 20-30% of memory usage to around 64% of memory, (measured by watching with top) and after that, paplayer starts to fail when trying to load the next song from NFS when it moves to the next song in the playlist. (but you can still start the failing songs one-by-one). At around 68% memory usage, it fails even loading songs one-by-one. A crash usually follows shortly afterwards. I’m not clear if this is a general texture thing, or only on the musicvisualization screen. (perhaps some combination of the skin having the placeholder for actual visualzations mixed with general back ground images causes it). My skin actually has 3 different views at the moment which can be toggeled on the fly (with different views using a conditional on the visibility to flip which “view” control displayed. so, perhaps kodi is actually allocating memory for several copies of each image on mine for the hidden ones (despite them being the same image)… I cannot say I’ve noticed the issue in the OSMC skin, but that does not display fanart on the musicvisualization (unless there’s some setting I have not noticed to enable it)

The whole music playlist problem has been a plague on me for a while… which has been driving me batty, as I could not find any problem with my mounts, or the server share… and It only seems to happen on the music player (not with videos), and I could always still see everything on the mounted drive from the vero, and just killing kodi.bin and restarting always fixed it without a remount… but at least now I know that if I avoid going full-screen when playing music it won’t happen.

I’m not sure what sort of debugging would be needed to figure out where that memory is going.

This type of issue should probably be posted on the Kodi forums. If Kodi is leaking memory then it’s likely not an OSMC issue.

Any idea which forum (or thread) to bring that up in?

I’ve been debating whether to test with 19 to see if it’s still an issue, but not sure if it’s stable enough yet (or how easy it is to revert if it is not), or how many of the plugins I use daily (tvheadend and comedy central at least) are functional on 19. I’ve also was given to understand 19 was going to revamp the skinning… but have not seen any details on what the actual changes are going to be.

I would guess that there is an add-on that you are using causing the problem. It can be hard to troubleshoot that. Maybe disable all of them, then turn them back on one by one until you find the culprit.

The memory leak isn’t from any of the addons. It only happens (that I’ve noticed) on the music screen (for me at least), and not when I use one of the video addons like tvheadend or comedy central. I did try disabling every addon I could think of to narrow it down. Seems to be just displaying fanart on the music screen which does it.

Have you tried using the OSMC skin to see if you have the same problem with it?

Like I said, the OSMC skin does not appear to display fanart on the music screen, so not applicable there.

Then I suggest you post on the Kodi forums. Sorry, I can’t suggest exactly where as I’ve not seen this issue to haven’t researched it on the Kodi forums.