QT 64 bit QQuickWidget Memory Leak
-
I am using Qt 5.15.2 MinGW 8.1.0 to create an application that includes qquickwidgets on Windows. If i build it on MinGW 8.1.0 32 bit there is no memory leak problem. But when i build it on 64 bit it leaks memory when qquickwidget moved or resized. I wrote a simple program to test it and it leaks memory even with this simple example. When i resize the window, memory starts rising non-stop. But as i said there is no such a thing with 32 bit version. I even tried Qt 5.15.1 and 5.14.2 but it still leaks. Here is the simple program i wrote to test:
mainwindow.h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QQuickWidget> QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H
mainwindow.cpp
#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); QQuickWidget* widget = new QQuickWidget(); widget->setSource(QUrl("qrc:/example.qml")); widget->setResizeMode(QQuickWidget::SizeRootObjectToView); setCentralWidget(widget); } MainWindow::~MainWindow() { delete ui; }
main.cpp
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
example.qml
import QtQuick 2.0 Item { anchors.fill: parent Rectangle{ anchors.fill: parent color: "black" } Text{ color: "white" text: "Example!" } }
-
Adding QCoreApplication::setAttribute(Qt::AA_UseOpenGLES) to the main file solves the problem. I think there is something wrong with intel driver. Right now there is no solution except using open gl es.
Here is my dxdiag output if anyone interested:
--------------- Display Devices --------------- Card name: Intel(R) UHD Graphics 620 Manufacturer: Intel Corporation Chip type: Intel(R) UHD Graphics Family DAC type: Internal Device Type: Full Device (POST) Device Key: Enum\PCI\VEN_8086&DEV_3EA0&SUBSYS_857F103C&REV_02 Device Status: 0180200A [DN_DRIVER_LOADED|DN_STARTED|DN_DISABLEABLE|DN_NT_ENUMERATOR|DN_NT_DRIVER] Device Problem Code: No Problem Driver Problem Code: Unknown Display Memory: 4131 MB Dedicated Memory: 128 MB Shared Memory: 4003 MB Current Mode: 1920 x 1080 (32 bit) (60Hz) HDR Support: Not Supported Display Topology: Internal Display Color Space: DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 Color Primaries: Red(0.646484,0.332031), Green(0.290039,0.605469), Blue(0.149414,0.059570), White Point(0.313477,0.329102) Display Luminance: Min Luminance = 0.500000, Max Luminance = 270.000000, MaxFullFrameLuminance = 270.000000 Monitor Name: Generic PnP Monitor Monitor Model: unknown Monitor Id: AUO593D Native Mode: 1920 x 1080(p) (60.033Hz) Output Type: Internal Monitor Capabilities: HDR Not Supported Display Pixel Format: DISPLAYCONFIG_PIXELFORMAT_32BPP Advanced Color: Not Supported Driver Name: C:\WINDOWS\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_90af7db2c816ac7b\igdumdim64.dll,C:\WINDOWS\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_90af7db2c816ac7b\igd10iumd64.dll,C:\WINDOWS\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_90af7db2c816ac7b\igd10iumd64.dll,C:\WINDOWS\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_90af7db2c816ac7b\igd12umd64.dll Driver File Version: 27.20.0100.9466 (English) Driver Version: 27.20.100.9466 DDI Version: 12 Feature Levels: 12_1,12_0,11_1,11_0,10_1,10_0,9_3,9_2,9_1 Driver Model: WDDM 2.6 Graphics Preemption: Triangle Compute Preemption: Thread Miracast: Supported Detachable GPU: No Hybrid Graphics GPU: Integrated Power P-states: Not Supported Virtualization: Paravirtualization Block List: No Blocks Catalog Attributes: Universal:False Declarative:True Driver Attributes: Final Retail Driver Date/Size: 30.03.2021 03:00:00, 1459240 bytes WHQL Logo'd: Yes WHQL Date Stamp: Unknown Device Identifier: {D7B78E66-7DE0-11CF-7657-1BA5B9C2D635} Vendor ID: 0x8086 Device ID: 0x3EA0 SubSys ID: 0x857F103C Revision ID: 0x0002 Driver Strong Name: oem32.inf:5f63e5345b9625c8:iWHL_w10_DS:27.20.100.9466:PCI\VEN_8086&DEV_3EA0 Rank Of Driver: 00CF2001 Video Accel: ModeMPEG2_A ModeMPEG2_C ModeWMV9_C ModeVC1_C DXVA2 Modes: DXVA2_ModeMPEG2_VLD DXVA2_ModeMPEG2_IDCT DXVA2_ModeVC1_D2010 DXVA2_ModeWMV9_IDCT DXVA2_ModeVC1_IDCT DXVA2_ModeH264_VLD_NoFGT DXVA2_ModeH264_VLD_Stereo_Progressive_NoFGT DXVA2_ModeH264_VLD_Stereo_NoFGT DXVA2_ModeH264_VLD_Multiview_NoFGT DXVA2_ModeVP8_VLD DXVA2_ModeHEVC_VLD_Main DXVA2_ModeHEVC_VLD_Main10 DXVA2_ModeVP9_VLD_Profile0 DXVA2_ModeVP9_VLD_10bit_Profile2 Deinterlace Caps: {BF752EF6-8CC4-457A-BE1B-08BD1CAEEE9F}: Format(In/Out)=(YUY2,YUY2) Frames(Prev/Fwd/Back)=(0,0,1) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_EdgeFiltering {335AA36E-7884-43A4-9C91-7F87FAF3E37E}: Format(In/Out)=(YUY2,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_BOBVerticalStretch {5A54A0C9-C7EC-4BD9-8EDE-F3C75DC4393B}: Format(In/Out)=(YUY2,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend {BF752EF6-8CC4-457A-BE1B-08BD1CAEEE9F}: Format(In/Out)=(UYVY,YUY2) Frames(Prev/Fwd/Back)=(0,0,1) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_EdgeFiltering {335AA36E-7884-43A4-9C91-7F87FAF3E37E}: Format(In/Out)=(UYVY,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_BOBVerticalStretch {5A54A0C9-C7EC-4BD9-8EDE-F3C75DC4393B}: Format(In/Out)=(UYVY,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend {BF752EF6-8CC4-457A-BE1B-08BD1CAEEE9F}: Format(In/Out)=(YV12,YUY2) Frames(Prev/Fwd/Back)=(0,0,1) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_EdgeFiltering {335AA36E-7884-43A4-9C91-7F87FAF3E37E}: Format(In/Out)=(YV12,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_BOBVerticalStretch {5A54A0C9-C7EC-4BD9-8EDE-F3C75DC4393B}: Format(In/Out)=(YV12,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend {BF752EF6-8CC4-457A-BE1B-08BD1CAEEE9F}: Format(In/Out)=(NV12,YUY2) Frames(Prev/Fwd/Back)=(0,0,1) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_EdgeFiltering {335AA36E-7884-43A4-9C91-7F87FAF3E37E}: Format(In/Out)=(NV12,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_BOBVerticalStretch {5A54A0C9-C7EC-4BD9-8EDE-F3C75DC4393B}: Format(In/Out)=(NV12,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend {BF752EF6-8CC4-457A-BE1B-08BD1CAEEE9F}: Format(In/Out)=(IMC1,YUY2) Frames(Prev/Fwd/Back)=(0,0,1) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_EdgeFiltering {335AA36E-7884-43A4-9C91-7F87FAF3E37E}: Format(In/Out)=(IMC1,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_BOBVerticalStretch {5A54A0C9-C7EC-4BD9-8EDE-F3C75DC4393B}: Format(In/Out)=(IMC1,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend {BF752EF6-8CC4-457A-BE1B-08BD1CAEEE9F}: Format(In/Out)=(IMC2,YUY2) Frames(Prev/Fwd/Back)=(0,0,1) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_EdgeFiltering {335AA36E-7884-43A4-9C91-7F87FAF3E37E}: Format(In/Out)=(IMC2,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_BOBVerticalStretch {5A54A0C9-C7EC-4BD9-8EDE-F3C75DC4393B}: Format(In/Out)=(IMC2,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend {BF752EF6-8CC4-457A-BE1B-08BD1CAEEE9F}: Format(In/Out)=(IMC3,YUY2) Frames(Prev/Fwd/Back)=(0,0,1) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_EdgeFiltering {335AA36E-7884-43A4-9C91-7F87FAF3E37E}: Format(In/Out)=(IMC3,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_BOBVerticalStretch {5A54A0C9-C7EC-4BD9-8EDE-F3C75DC4393B}: Format(In/Out)=(IMC3,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend {BF752EF6-8CC4-457A-BE1B-08BD1CAEEE9F}: Format(In/Out)=(IMC4,YUY2) Frames(Prev/Fwd/Back)=(0,0,1) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_EdgeFiltering {335AA36E-7884-43A4-9C91-7F87FAF3E37E}: Format(In/Out)=(IMC4,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend DeinterlaceTech_BOBVerticalStretch {5A54A0C9-C7EC-4BD9-8EDE-F3C75DC4393B}: Format(In/Out)=(IMC4,YUY2) Frames(Prev/Fwd/Back)=(0,0,0) Caps=VideoProcess_YUV2RGB VideoProcess_StretchX VideoProcess_StretchY VideoProcess_AlphaBlend D3D9 Overlay: Supported DXVA-HD: Supported DDraw Status: Enabled D3D Status: Enabled AGP Status: Enabled MPO MaxPlanes: 3 MPO Caps: RGB,YUV,BILINEAR,HIGH_FILTER,STRETCH_YUV,STRETCH_RGB,IMMEDIATE,HDR (MPO3) MPO Stretch: 5.000X - 0.334X MPO Media Hints: colorspace Conversion MPO Formats: NV12,YUY2,R16G16B16A16_FLOAT,R10G10B10A2_UNORM,R8G8B8A8_UNORM,B8G8R8A8_UNORM PanelFitter Caps: RGB,YUV,BILINEAR,HIGH_FILTER,STRETCH_YUV,STRETCH_RGB,IMMEDIATE,HDR (MPO3) PanelFitter Stretch: 5.000X - 0.334X Extension Drivers: Driver Name: C:\WINDOWS\System32\DriverStore\FileRepository\iigd_ext.inf_amd64_53a16d0372ccca73\iigd_ext.inf Driver Version: 25.20.100.6617 Driver Date: 03/08/2019 Driver Provider: Intel Corporation Catalog Attributes: Universal:N/A Declarative:True Driver Name: C:\WINDOWS\System32\DriverStore\FileRepository\iigd_ext.inf_amd64_3f203d9ef98f2598\iigd_ext.inf Driver Version: 26.20.100.7261 Driver Date: 09/25/2019 Driver Provider: Intel Corporation Catalog Attributes: Universal:N/A Declarative:True Driver Name: C:\WINDOWS\System32\DriverStore\FileRepository\iigd_ext.inf_amd64_fd1b3e6af8f9edf6\iigd_ext.inf Driver Version: 27.20.100.8190 Driver Date: 05/05/2020 Driver Provider: Intel Corporation Catalog Attributes: Universal:N/A Declarative:True Driver Name: C:\WINDOWS\System32\DriverStore\FileRepository\iigd_ext.inf_amd64_4ce37bf3b91002eb\iigd_ext.inf Driver Version: 26.20.100.7324 Driver Date: 10/07/2019 Driver Provider: Intel Corporation Catalog Attributes: Universal:N/A Declarative:True Driver Name: C:\WINDOWS\System32\DriverStore\FileRepository\iigd_ext.inf_amd64_9c692cfbf96b9b87\iigd_ext.inf Driver Version: 26.20.100.7756 Driver Date: 03/13/2020 Driver Provider: Intel Corporation Catalog Attributes: Universal:N/A Declarative:True Component Drivers: Driver Name: Unknown Driver Version: Unknown Driver Date: Unknown Driver Provider: Unknown Catalog Attributes: N/A Driver Name: Unknown Driver Version: Unknown Driver Date: Unknown Driver Provider: Unknown Catalog Attributes: N/A