Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.10
-
None
Description
There is a memory leak in the Apple camera code related to activation. This is only tested FFmpeg backend. The memory leak is easy to reproduce by constructing QCamera objects, activating them and destroying them in rapid succession.
This has only been tested on macOS.
Here is a minimal reproducer main.cpp that will construct, activate and destroy a QCamera object every 0.1 seconds.
#include "mainwindow.h" #include <QApplication> #include <QTimer> #include <QPermission> #include <QtMultimedia/QCamera> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); QTimer myTimer; myTimer.setInterval(100); QObject::connect( &myTimer, &QTimer::timeout, &myTimer, []() { QCamera camera; camera.start(); }); a.requestPermission( QCameraPermission{}, [&](const QPermission &permission) { if (permission.status() != Qt::PermissionStatus::Granted) { a.exit(-1); } myTimer.start(); }); return a.exec(); }
Attached is an image of the memory tracker when running the app through Xcode.