Unfreed memory when playing images
Posted: 15 Dec 2021 12:04
Hello,
I am trying to create a player which will play an endless slideshow of both images and videos. It should run for an unlimited time, therefore, memory usage is important to me.
I would like to ask what is the correct way to free memory after playing media. According to https://wiki.videolan.org/LibVLC_Tutorial/, calling on the media is enough. However, this seems to resolve the memory when playing videos but not for images. If I repeatedly play an image, the memory consumptions increases each play.
From my understanding the release function can not free the memory itself as the medium is played after being released in the tutorial. Is there something I'm missing?
I am using python binding for libVLC (https://github.com/oaubert/python-vlc). I appreciate any help I can get, thank you in advance. Here's a minimal code to reproduce the issue:
I am trying to create a player which will play an endless slideshow of both images and videos. It should run for an unlimited time, therefore, memory usage is important to me.
I would like to ask what is the correct way to free memory after playing media. According to https://wiki.videolan.org/LibVLC_Tutorial/, calling
Code: Select all
libvlc_media_release(m);
From my understanding the release function can not free the memory itself as the medium is played after being released in the tutorial. Is there something I'm missing?
I am using python binding for libVLC (https://github.com/oaubert/python-vlc). I appreciate any help I can get, thank you in advance. Here's a minimal code to reproduce the issue:
Code: Select all
import vlc
import time
media_player = vlc.MediaPlayer()
media = vlc.Media("large_image.jpg")
media_player.set_media(media)
media.release()
media_player.play()
time.sleep(10)
media_player.set_media(media)
media.release()
media_player.play()
time.sleep(10)
media_player.set_media(media)
media.release()
media_player.play()
time.sleep(10)
media_player.set_media(media)
media.release()
media_player.play()
time.sleep(10)
media_player.set_media(media)
media.release()
media_player.play()
time.sleep(10)
media = vlc.Media("video.mp4")
media_player.set_media(media)
media.release()
media_player.play()
time.sleep(10)
media_player.set_media(media)
media.release()
media_player.play()
time.sleep(10)
media_player.set_media(media)
media.release()
media_player.play()
time.sleep(10)
media_player.set_media(media)
media.release()
media_player.play()
time.sleep(10)