load / unload media/mediaplayer without loosing RAM memory

This forum is about all development around libVLC.
FL53
Blank Cone
Blank Cone
Posts: 39
Joined: 09 Mar 2018 17:58

load / unload media/mediaplayer without loosing RAM memory

Postby FL53 » 27 Apr 2019 11:18

Hi,

I try to load /unload many files inside the same application but each time I unload a media+mediaplayer (libvlc_media_player_release/libvlc_media_release) then load (libvlc_media_new_path/libvlc_media_player_new_from_media) I loose some memory (I checked my application and when not calling the load/unload methods memory stays at 60Mb all the time).

Here is the full log (verbose=4) : https://drive.google.com/file/d/1edHad8 ... sp=sharing but I did not see anything about memory (load video1.mp4 then video2.mp4 then video1.mp4 and loose hundreds of Mb in RAM :( ).

By the way, I use libVLC 4 with OpenGL callbacks.

I may not understand well the way to load/unload the media/mediaplayer. Have you got an idea to fix that ?

Regards

fossette
Blank Cone
Blank Cone
Posts: 12
Joined: 06 Apr 2019 16:26
Operating System: FreeBSD
Contact:

Re: load / unload media/mediaplayer without loosing RAM memory

Postby fossette » 28 Apr 2019 00:11

Just a few hints, you may double-check your LibVLC calls. Some data returned by the library must be freed by the caller. Also, some data may be poked into a structure that you provided, and that poked data may need to be released as well.

FL53
Blank Cone
Blank Cone
Posts: 39
Joined: 09 Mar 2018 17:58

Re: load / unload media/mediaplayer without loosing RAM memory

Postby FL53 » 02 May 2019 18:59

I already checked my code (more than twice) before writing a new topic :). I saw something interesting when putting the option "--start-paused" and calling libvlc_mediaplayer_play() , video does not start at all and I cannot see leaks unless I call libvlc_media_player_pause(). Then video plays and memory usage is growing while decoding (obviously) but when releasing meadia and media_player memory is not freed entirely (this may be interesting to understand where the memory is lost ?).

I based my code to render in my OpenGL window on the libVLC 4 OpenGL callback example ... and so I did for the loading/unloading of the videos. It should be easy to reproduce the memory leak just adding some events in the OpenGL callback libVLC 4 sample (to load new videos and start playing them).

My next try will be to delete the VLC instance and recreate one each time I want to play a video but it does not sound good to me ! I keep you informed ...

FL53
Blank Cone
Blank Cone
Posts: 39
Joined: 09 Mar 2018 17:58

Re: load / unload media/mediaplayer without loosing RAM memory

Postby FL53 » 09 May 2019 19:12

I used the OpenGL callback sample given by VLC dev team to implement a simple player and mapped keys to stop and reload the video (via SDL events). And that's it ! When stopping the video (deleting the mediaplayer and media) it does not free all the memory (I can see the memory used growing in the task manager after stopping and asking for reload multiple times).
Have you got an idea to fix this ?

FL53
Blank Cone
Blank Cone
Posts: 39
Joined: 09 Mar 2018 17:58

Re: load / unload media/mediaplayer without loosing RAM memory

Postby FL53 » 21 Aug 2019 17:12

I tried using the same media player for multiple files. Before I deleted it to recreate it using libvlc_media_media_new_from_media each time I wanted to change the video (I was hoping t. I only do that once now and use libvlc_media_player_set_media to reuse the first mediaplayer created. But it does not fix the issue. It seems that memory allocated to media is not completely released using the libvlc_media_release function.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 21 guests