Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.15.10, 6.3.1
-
Windows 10 Pro 21H2, MSVC 2019 x64
-
-
37a9d533c5 (qt/qtconnectivity/dev) e8240ffe2a (qt/qtconnectivity/6.4) a9910088b2 (qt/qtconnectivity/6.3) a9910088b2 (qt/tqtc-qtconnectivity/6.3) e8240ffe2a (qt/tqtc-qtconnectivity/6.4) 37a9d533c5 (qt/tqtc-qtconnectivity/dev)
-
Foundation PM Staging
Description
Repeatedly scanning with QBluetoothDeviceDiscoveryAgent on Windows causes RAM usage to rise continuously (as reported by Resource Monitor). In Debug mode, the app consumes <8MB at startup, rising to 50MB by the 50th scan.
The same leak was not observed on Ubuntu 22.04 (using top or `pmap -x`).
Test Code
#include <QBluetoothDeviceDiscoveryAgent> #include <QCoreApplication> #include <QDebug> int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); QBluetoothDeviceDiscoveryAgent discoveryAgent; discoveryAgent.setLowEnergyDiscoveryTimeout(5000); auto doScan = [&]{ static int i = 0; qDebug() << "Starting scan; Iteration" << ++i; discoveryAgent.start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod); }; QObject::connect(&discoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished, &app, [&] { qDebug() << "Found" << discoveryAgent.discoveredDevices().count() << "devices"; doScan(); }); doScan(); return app.exec(); }
Notes
- I tried creating a new QBluetoothDeviceDiscoveryAgent for each scan and deleting at the end of the scan, but that made no difference.
- This forum thread suggests that the bug is in Windows: https://forum.qt.io/topic/98774/crashing-when-use-qbluetooth-on-windows-10-with-a-btle-adapter/