homov / LibMpv

Complete libmpv API wrapper
MIT License
41 stars 4 forks source link

High memory usage #2

Closed navhaxs closed 1 year ago

navhaxs commented 1 year ago

Hey @homov, firstly thanks for putting together this Avalonia wrapper 👍🏼 👍🏼

I do have a question - when I maximise the window, the memory usage grows without bound. Any ideas why? e.g. 10GB after 30 seconds, 20GB after ~1 minute: image

It grows very quickly!

Snipaste_2023-06-05_22-16-49 Snipaste_2023-06-05_22-17-06

homov commented 1 year ago

Hello! I was unable to replicate your result. When I run I don't see this problem.

Memory consumption when playing in full Window

navhaxs commented 1 year ago

Ah I figured out how to reproduce. It only happens when I maximise on my big monitor.

You can add Height="1440" Width="2560" to the control, it also triggers the problem this way.

<TabItem Header="OpenGL">
    <Viewbox>
        <local:OpenGlVideoView MpvContext="{Binding OpenGLMpvContext}" Height="1440" Width="2560" />
    </Viewbox>
</TabItem>
<TabItem Header="Software">
    <Viewbox>
        <local:SoftwareVideoView MpvContext="{Binding SoftwareMpvContext}" Height="1440" Width="2560"/>
    </Viewbox>
</TabItem>
homov commented 1 year ago

Yes you are right. When using opengl, I see the same effect. This effect is not present in software rendering. So far I have no idea why this is happening.

homov commented 1 year ago

I also tried on Linux. Works without this problem. Most likely on Windows you need to use native rendering, and on other platforms opengl rendering. I can assume that this is directly related to libmpv opengl rendering on Windows.

homov commented 1 year ago

Apparently, the problem is solved in the latest beta versions of Avalonia. Please, confirm if you can.

navhaxs commented 1 year ago

image

Thanks @homov just tested, looks fixed to me 👍🏼