I am writing a python program, running on a raspberry pi (PI 3 A+), that plays a song every 10 minutes. I am using python-vlc to play the song through the pi's headphone jack.
PlaySong() is a function that gets called (successfully) every 10 minutes.
import vlc
def PlaySong():
p = vlc.MediaPlayer("file:///home/pi/music.mp3")
p.play()
This works as expected the first 6 times. After 6 times, it doesn't play anymore, and instead throws this error:
mmap() failed: cannot allocate memory
This happens even when I change it from every 10 minutes to every 2 minutes, so it doesn't have to do with the amount of time.
Task Manager shows that there is still plenty of memory available on the pi itself.
Any suggestions?