-
-
Notifications
You must be signed in to change notification settings - Fork 414
leak handler #360
Comments
Did you try with the latest |
I tested the dev version. It's definitely better when playing a video, but not at photos. To play the picture (in newer versions of the vlc). I use the "--vout=glwin32" option after a long period of time there is a problem "vm3dgl.dll access violation" |
on 2.2.5.1 lib and recreate:
Not helping, is there any more ideas how to properly dispose everything? |
I don't really understand your issue. |
Simple, |
I have created a small adhoc test to check this issue. A winform with 2 buttons and a flowpanel. I kept creating and destroying players. I was not able to reproduce this issue. I found no leak during theses tests. For the case of end reached, the recomendation to follow is here: |
After some more analisys I see a possible memory leak. I have verified that during the GetMedia() process and following steps: For every Player "restart" Actually, inside VlcMediaPlayer->GetMedia(): `
` If there was already a VlcMedia created, it is returning a new VlcMedia (which calls RegisterEvents) but noone is calling UnregisterEvents from the existing media. Is it correct to have multiple VlcMedia for a single VlcControl? Could we just store the VlcMedia in a property of the VlcControl so GetMedia just returns it? and then you don't need to create multiple VlcMedias, and you dont need to call Registration so many times. |
I confirm the memory leak (if not disposing) Everytime you SetMedia() If you call GetMedia you are actually creating a new one. So anyone using Statistics very often will be having a huge leak. Disposing the vlcMedia, unregister the attached events, but it does not remove the media from the LoadedMedias... Stop, does not release medias either. The only possible way to release everything right now is to dispose the player. I would not mind to fix it myself although I am not quite sure what is the need of a list of medias per player. (was it related to a playlist or something?, can I force a single VlcMedia per player?) |
Thanks for your time. the recommended way in libvlc sample is to release the media reference as soon as set_media has been called. I'm not sure how we should handle this. |
for reference, here, they release each time a new set media is called : https://code.videolan.org/videolan/vlc-android/blob/master/libvlc/src/org/videolan/libvlc/MediaPlayer.java#L581 So yes, one media per media player, release on SetMedia |
I did a small test and modified VlcMediaPlayer to have only one VlcMedia associated. I confirm in the test that LoadedMedias is 1 all the time, no more increasing per "GetMedia" But... even though it calls I can see through Memory Diagnostic tools that 6 handlers are leaked on every SetMedia So with my changes I decrease the memory leak but it is still leaking the handlers... I am totally clueless about why calling DetachEvent is not detaching the handler. |
After some more analysis it seems that although the handlers are not inmediatelly released they are disposed eventually so in the long term the memory keeps stable. Also, if the target is one VlcMedia per player, then VlcMedia can be simplified a lot, most of the work I did in my previous pull #474 is not necessary. The LoadedMedias static dictionary is not necessary, and so the multithread control is not necessary either. I have test it for a few hours with multiple players with Vlc streaming a 30 seconds video. After many EndReachEvents the memory is still stable. If @jeremyVignelles don't mind I will add the Sample I was using to the pull. (called Samples.Winforms.MultiplePlayers) |
Please do :) We need a sample like this. |
Done |
Thanks dilandau2001. im using player to play same Videos in loop. VlcMedia.cs
in VlcMediaPlayer.cs
it is stupid but definitely to think more about "caching" / ? |
@GoGs99 : I don't understand. What do you mean by "caching"? What would you like to cache? |
huh, im sorry was 1 year ago, hard to remember why I actually did that... Edit: Now i see and dilandau2001 says something about that
|
It should be fixed in 3.0.0-develop315, can you check it once published to NuGet? |
I have an issue / a question (pick one) about Vlc.DotNet.
Generic information
Summary
when
vlc.endreached
play next file few handlers get leaked.
Stop
play(other file)
every time you do stop and play handle (event) leak
used windows kit
CMD: wpr -start Handle (COLLECT DATA)
DO YOUR START /STOP 100 times
CMD: wpr -stop c:\Handle.etl (SAVE DATA)
use wpa (windows performance analyzer)
cmd: wpa.exe
https://image.ibb.co/d8Yy0R/Capture.jpg
The text was updated successfully, but these errors were encountered: