Flyleaf icon indicating copy to clipboard operation
Flyleaf copied to clipboard

Possible handle leak when repeatedly create/play/stop/dispose flyleaf players

Open dev991301 opened this issue 1 year ago • 9 comments

I am using FlyleafLib.Controls.WPF 1.3.8 via nuget on .NET 8.

I have written a WPF app that repeatedly creates/plays/stops/disposes flyleaf players. Over time, the process seems to leak handles as shown in Performance Monitor: ReleaseHandleLeakGraph

I have made the code available in the github repo FlyleafCycleTest

Can you replicate the handle leak or is it particular to my system?

dev991301 avatar Mar 27 '24 05:03 dev991301

+Up

arslan38 avatar Apr 02 '24 15:04 arslan38

we are also seeing memory leaks on our side. @SuRGeoNix

t3therdev avatar Apr 03 '24 13:04 t3therdev

I will review this in the weekend

SuRGeoNix avatar Apr 03 '24 16:04 SuRGeoNix

hi @SuRGeoNix were you able to take a look into this?

t3therdev avatar Apr 08 '24 13:04 t3therdev

@dev991301 does this happen with trace log off? I cannot reproduce it so far (can you use the release's ffmpeg libraries?)

image

SuRGeoNix avatar Apr 09 '24 11:04 SuRGeoNix

@dev991301 does this happen with trace log off? I cannot reproduce it so far (can you use the release's ffmpeg libraries?)

@SuRGeoNix It does seem to happen with trace off. I am using the FFmpeg libraries that come from the Flyleaf 3.7.16 release. It also doesn't seem to matter if video acceleration is enabled or disabled.

ReleaseHandleLeakGraph_TraceOff_VA

In the Github code I submitted, would you be able to uncomment the other players in MainWindow.xaml and see what the handle count trend looks like?

MainWindow_xaml

dev991301 avatar Apr 09 '24 23:04 dev991301

Here my results with 9 players:-

(Stable RAM/VRAM/GPU usage/Handles)

image

with Video Acceleration off

image

SuRGeoNix avatar Apr 10 '24 08:04 SuRGeoNix

@SuRGeoNix did you leave it running for a long period of time?

t3therdev avatar Apr 11 '24 14:04 t3therdev

@t3therdev about 30'

SuRGeoNix avatar Apr 11 '24 15:04 SuRGeoNix

Guys, any news with this one? I couldn't reproduce it also in systems with different GPUs.

SuRGeoNix avatar May 06 '24 08:05 SuRGeoNix

I think the handle growth on my machines may be related to the version of the integrated Intel graphics drivers I am using. Running with an old version of a graphics driver the handles didn't grow (version 27.20.100.9079 which came from HP) but when upgraded to a newer Intel driver it did grow (version 31.0.101.5382). It also grew on a machine running Intel UHD graphics around version 31.0.x.x vintage. But it didn't grow when running off the NVIDIA graphics.

dev991301 avatar May 06 '24 10:05 dev991301

Everything points to GPU / drivers so I'm not sure if there is anything left from Flyleaf side to fix. I had different issues with RX 580 and had to use older drivers to make it work properly. So I'm afraid I will close this as is not related to the library.

SuRGeoNix avatar May 06 '24 12:05 SuRGeoNix

Possible related WPF issue here dotnet/wpf/issues/7704

It would be interested to see if the problematic GPU/drivers having the same issue with WinForms.

Update: Seems that Config.Decoder.ZeroCopy = FlyleafLib.ZeroCopy.Enabled; could be a workaround.

SuRGeoNix avatar May 08 '24 07:05 SuRGeoNix