Important: Please read the Qt Code of Conduct -

QOpenGLWidget GPU memory leak

  • Hello,

    I have QTabWidget setup so everytime I push button, it creates new tab with QOpenGLWidget inside. Nothing else.

    First tab, memory usage jumps from 12MB to 336 MB then after a while goes down to 180 MB. Each new tab adds around 30 MB.

    If I click four times I will have four tabs, each with its own QOpenGLWidget instance taking up around 270MB.

    Now if I destroy ALL tabs memory goes UP! to 414MB and stays there. This is ALL VRAM.

    First of all, even if I was not deleting QOpenGLWidgets, I see no reason for the memory usage to go up.
    Second, I DO delete them.

    To reproduce: Create project with MainWindow and TabWidget inside and some trigger event (PushButton or action etc.)
    And Implement two methods.

    void Project::on_actionOpen_triggered()
    	ui->tabWidget->addTab(new QOpenGLWidget, "Tab");
    void Project::on_tabWidget_tabCloseRequested(int tabId)
    	QOpenGLWidget *vw = static_cast<QOpenGLWidget*>(ui->tabWidget->widget(tabId));

    That's it.

    Windows 10 Pro
    QT 5.14.1
    Visual Studio 2017

    I can see memory usage in VS Profiling tools as well as in Task Manager.

  • TabWidget::Clear() does not emit close request....

  • TabWidget::Clear() does not emit close request....

Log in to reply