Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.15.1, 6.0.0 RC
-
-
c2839843f23fb5c289175cb9577981d48dd273fc
Description
Since 5.14 'receiver' QObjects will, on destruction, move its connection in the 'sender' object to an orphaned list, due for cleanup later.
The orphan list is cleaned up on the sender's next signal emission, or on its destruction.
In certain circumstances the sender object rarely or never emits signals, and is long-lived. This leads to a long-lived soft leak every time a connection is made to it.
Can be seen with this example, which is a reduced example of what happens in QNetworkAccessManager:
int main(int argc, char* argv[]) { QCoreApplication qapp(argc, argv); QThread th; th.start(); for (int i = 0; i < 1'000'000; ++i) { QObject *o = new QObject; QObject::connect(&th, &QThread::finished, o, &QObject::deleteLater); o->moveToThread(&th); QMetaObject::invokeMethod(o, &QObject::deleteLater); QThread::msleep(10); } return 0; }
Attachments
Issue Links
- duplicates
-
QTBUG-87774 QToolBar::clear() leaks memory
- Closed
- is duplicated by
-
QTBUG-90576 Possible memory leak in TextInput
- Closed
- is required for
-
QTBUG-86368 QQmlContext leak when connecting to and destroying dynamically created object
- Closed
-
QTBUG-88063 Memory leak in QNetworkAccessManager from QMetaObjectPrivate::connect
- Closed
-
QTBUG-88587 QQuickWidget object stay in QML Engine cache after deletion
- Closed
- relates to
-
QTBUG-90576 Possible memory leak in TextInput
- Closed
- resulted in
-
QTBUG-106025 REG: isSignalConnected creates a dead lock.
- Closed
For Gerrit Dashboard: QTBUG-88248 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
320789,15 | QObject: cleanup the orphaned connection lists on destruction | dev | qt/qtbase | Status: MERGED | +2 | 0 |
322683,18 | Fix crash in concurrent disconnect | dev | qt/qtbase | Status: MERGED | +2 | 0 |
355074,2 | Fix crash in concurrent disconnect | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 |
355075,2 | Fix crash in concurrent disconnect | 6.1 | qt/qtbase | Status: MERGED | +2 | 0 |
355076,4 | QObject: cleanup the orphaned connection lists on destruction | 6.1 | qt/qtbase | Status: MERGED | +2 | 0 |
355077,4 | QObject: cleanup the orphaned connection lists on destruction | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 |
355085,2 | Fix crash in concurrent disconnect | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: ABANDONED | 0 | 0 |
355086,2 | QObject: cleanup the orphaned connection lists on destruction | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: ABANDONED | +2 | 0 |
363027,9 | Fix crash in concurrent disconnect | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |