mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
27.85k stars 2.87k forks source link

HDR10 Video memory leak #13307

Open Hlongyu opened 8 months ago

Hlongyu commented 8 months ago

Reproduction steps

I'm using two computers with the same configuration to play the following code. One computer plays an HDR10 video, and the other plays an 8-bit video. Then observe their memory usage. After five hours, obtain the memory curve

int main(int argc, char* argv[])  
{  
    QApplication a(argc, argv);  
    QWidget w;  
    w.setGeometry(0, 0, 3840, 2160);  
    w.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus);  
    mpv_handle* mpv = mpv_create();  
    int64_t wid = w.winId();  
    mpv_set_property(mpv, "wid", MPV_FORMAT_INT64, &wid);  
    mpv_set_property_string(mpv, "hwdec", "auto");  
    mpv_set_property_string(mpv, "loop-file", "inf");  
    mpv_set_property_string(mpv, "log-file", "mpv.log");  
    mpv_initialize(mpv);  
    const char* args[] = { "loadfile", "D:\\8k_60.webm", NULL };  
    mpv_command_async(mpv, 0, args);  
    w.show();  
    return a.exec();  
}

image image image

Actual behavior

hdr video memory leak.
Same in 4k hdr10 vp9 video.
Same in mpv v0.36.0-274-gbe922231 built on Sep 10 2023 01:04:13

Log file

mpv_leak.log mpv_no_leak.log

llyyr commented 8 months ago

mpv_set_property_string(mpv, "hwdec", "auto");

Can you try without this? Nvidia drivers are known for leaking memory

Hlongyu commented 8 months ago

mpv_set_property_string(mpv, "hwdec", "auto");

Can you try without this? Nvidia drivers are known for leaking memory

image

After 15 hours, check again, and there is still a leak, but it is much less than before.