FYI Only... My working RPi3 OSMC lessons

NOTE: This post is just a FYI for future OSMC travellers who might need some direction. Comments, as always, are welcome.

One of my biggest lessons was to realize that you are dealing with a board that only has 1gb of ram on it. After loading OSMC only like 780mb.

Tip 1, if you choose a skin… Make sure you know what you are doing. A heavy skin, in my case Aeon Nox, will make your experience a frustrating one…

Tip 2, try and create a job to watch your memory usage. This is a process that I fire off every minute, simply checking the free memory, and if need be, I.e. 130mb or less, I free up the memory.

Tip 3, buy a FAST SD card. Look for one with 70mbps+ read speed.

Tip 4, use LAN, not WLAN. In my case, this was particularly important since I have a drive connected to my pc, so need a fast (min 100mb) connection. Lay those cables…

These things made my setup be a smooth running one after months of frustration…

My setup.
Rpi 3 with:
Cooling fan and heat syncs
16GB UHS-I micro SD card (Up to 95MB/s Read and 20MB/s Write speed with Class 10 and U1 compatibility.)
Skin: Arctic Zypher
My library is on a mysql db on my pc.
Currently over 1500 movies and close to 900 series episodes.

My most intensive addon is a live paid TV streaming app which loads 400 channels and populates the TV Guide.

I have created a cronjob that runs the below script, every minute:

var=$(free | awk '/^Mem:/{print $4}')

freem=$((var / 1024))

if [ $freem -lt 131 ] 
then
  sudo -s echo 3 > /proc/sys/vm/drop_caches
  echo "Cache cleared. Was $freem $(date)"
fi

#check log file size... delete if over 400
file=/var/log/conclearmemout.log
minimumsize=400
actualsize=$(du -k "$file" | cut -f 1)
if [ $actualsize -ge $minimumsize ] 
then
    rm $file
fi

My advancedsettings file:

<?xml version="1.0" encoding="utf-8"?>
<advancedsettings>
	<videolibrary>
	<importwatchedstate>true</importwatchedstate><importresumepoint>true</importresumepoint>
	</videolibrary>
	<videodatabase>
		<name>MyVideos</name>
		<host>192.168.255.5</host>
		<user>kodi</user>
		<pass>passwww</pass>
		<type>mysql</type>
		<port>3306</port>
	</videodatabase>
	<cache>
		<buffermode>1</buffermode>
		<readfactor>4.0</readfactor>
		<memorysize>62914560</memorysize>
	</cache>
	<video>
		<excludefromscan>
			<regexp>[-\._ ](sample|trailer)[-\._ ]</regexp>
		</excludefromscan>
		<excludefromlisting>
			<regexp>[-\._ ](sample|trailer)[-\._ ]</regexp>
		</excludefromlisting>
	</video>
</advancedsettings>

Hope someone out there finds this helpful…

Finally, a word of thanks to Sam and the guys that put the hard work in for us.

Good luck with the new Vero+…

Hi,

Great tips just one thing:

That should be WLAN not WAN.

WLAN = Wireless Local Area Network
WAN = Wide area network (like the the internet.)

Thanks Tom.

1 Like

You shouldn’t have to “free up” your RAM (Tip 2). Have a look here: https://www.linuxatemyram.com/

Hi,

Guides/epg can use a lot a memory when using a lot of channels, and cause kodi to restart to free the memory.

I can’t test to see if this script will help, as I’m no longer using a pi3, moved on to vero4k. It may be providing memory from disk caching quicker than the OS is though.

Thanks Tom.

@Tom_Doyle

WLAN

Corrected

Memory Usage Guide

Yup, agreed…
in my case, because local TV is a non option for me, this is one of the main reasons why I wanted the setup.

@casperklein

No need for memory clearing

I promise you, this helps me a lot.
I understand the link you sent, but I track the memory usage on the Pi using an app on my phone, and just before a crash, I would see the memory plummet…

Although, it could be down to the skin I was using.

Also, if you look at the Cronjob script, you will note I log to a file when I clean memory…
Here is an output of that log:

Cache cleared. Was 115 Mon Jul 30 20:14:01 SAST 2018
Cache cleared. Was 121 Mon Jul 30 20:23:01 SAST 2018
Cache cleared. Was 126 Mon Jul 30 20:42:01 SAST 2018
Cache cleared. Was 117 Mon Jul 30 22:04:02 SAST 2018
Cache cleared. Was 105 Mon Jul 30 22:08:02 SAST 2018
Cache cleared. Was 122 Mon Jul 30 22:12:02 SAST 2018
Cache cleared. Was 86 Mon Jul 30 22:16:02 SAST 2018
Cache cleared. Was 104 Mon Jul 30 22:20:01 SAST 2018
Cache cleared. Was 123 Tue Jul 31 08:23:01 SAST 2018
Cache cleared. Was 77 Tue Jul 31 20:33:01 SAST 2018
Cache cleared. Was 128 Wed Aug  1 01:47:01 SAST 2018
Cache cleared. Was 129 Wed Aug  1 04:55:01 SAST 2018

What you’ve done may be working for you for now, but I’d suggest that you find the root of the problem as the memory just should not be plummeting like you say. So you need to find out what’s taking up all the memory! What you have now is a band-aid that will probably stop working in the future until you fix the actual problem.

2 Likes

Agreed…
Or I’ll just wait for a 2gb RAM version of the pi.
For now, it’s OK for me.