Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in
.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
"Just like the program I provided, using Qt 5.15.2, Visual Studio 2019 (2022), a 4K display, and Intel integrated graphics, after compiling and running, when you hover the mouse back and forth between the top two buttons, continuously and rapidly repeating this action, you can observe that the program's memory usage keeps increasing until it crashes."
Qt Online Installer direct download:
https://download.qt.io/official_releases/online_installers/
Visit the Qt Academy at
https://academy.qt.io/catalog
@Christian-Ehrlicher
You can compile and run this project. I'm using Qt 5.15.2 + VS2019. Then, compile and run it in Qt Creator. After running, maximize the software, then continuously drag the graphic back and forth with the mouse to keep it refreshing constantly. This way, you can observe the memory continuously increasing in the Task Manager.
Not sure if the memory leak reported here was on the CPU side or GPU side but at least regarding GPU memory there are definitely bugs in the implementation and I've seen issues on X11, NV, Qt5.
This is what I found at the time.
https://forum.qt.io/topic/92179/xorg-vram-leak-because-of-qt-opengl-application/12
https://community.khronos.org/t/xorg-vram-leak-because-of-qt-opengl-application/76910/2
https://bugreports.qt.io/browse/QTBUG-69429
@SamiV123
Here are a few observations we made during debugging from our end:
The higher the screen resolution, the faster the memory leak occurs. This was the direct cause we identified for the issue. When our client's computer with a 4K resolution runs our application, it experiences a memory leak leading to a crash. Therefore, we reproduced the problem using a 4K resolution. Both our custom demo and the official Qt demo consistently exhibit this behavior.
We used Visual Studio's memory snapshot for analysis but didn't find any leaked stack traces.
On machines with NVIDIA dedicated graphics cards, setting the software mode to high performance, thereby ensuring it primarily uses the dedicated GPU for OpenGL rendering, prevents memory leaks.
On machines with Intel integrated graphics, memory accumulation and leaks occur.
I suspect this could be due to the integrated graphics struggling to handle the data, resulting in memory accumulation. However, this is just my speculation. Currently, this issue is quite challenging, and we haven't found a solution yet.
@xingqun
I did quick test with valgrind
==================5.15.2 on Ubuntu 22.04
==556545== LEAK SUMMARY:
==556545== definitely lost: 256 bytes in 1 blocks
==556545== indirectly lost: 32 bytes in 1 blocks
==556545== possibly lost: 0 bytes in 0 blocks
==556545== still reachable: 613,875 bytes in 10,922 blocks
==556545== suppressed: 0 bytes in 0 blocks
==556545== Reachable blocks (those to which a pointer was found) are not shown.
==556545== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==556545==
==556545== For lists of detected and suppressed errors, rerun with: -s
==556545== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
==================6.6.2 on Ubuntu 22.04
==557606== HEAP SUMMARY:
==557606== in use at exit: 346,588 bytes in 3,812 blocks
==557606== total heap usage: 232,769 allocs, 228,957 frees, 1,005,388,571 bytes allocated
==557606==
==557606== LEAK SUMMARY:
==557606== definitely lost: 0 bytes in 0 blocks
==557606== indirectly lost: 0 bytes in 0 blocks
==557606== possibly lost: 0 bytes in 0 blocks
==557606== still reachable: 344,572 bytes in 3,791 blocks
==557606== suppressed: 0 bytes in 0 blocks
==557606== Reachable blocks (those to which a pointer was found) are not shown.
==557606== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==557606==
==557606== For lists of detected and suppressed errors, rerun with: -s
==557606== ERROR SUMMARY: 6 errors from 4 contexts (suppressed: 0 from 0)
You may try a higher version of Qt5 or switch to Qt6.