Details
-
Bug
-
Resolution: Duplicate
-
P1: Critical
-
6.8.3, 6.9.0
-
Ubuntu 22.04
Description
Code
#include <QCoreApplication> #include <QJSEngine> #include <QJSValue> #include <QTimer> int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); QJSEngine engine; int counter = 0; QTimer timer; QObject::connect(&timer, &QTimer::timeout, qApp, [&] { engine.evaluate(QStringLiteral("let obj = { f: function() { return %1 } }").arg(counter)); counter++; if (counter % 200 == 0) // Collect garbage every 2s engine.collectGarbage(); else if (counter >= 1000) // Quit after 10s app.quit(); }); timer.start(10); return app.exec(); }
Outcomes (heaptrack logs)
(Qt 6.5.7) Each time engine.collectGarbage() is called, the consumed memory drops significantly:
(Qt 6.8.1+) engine.collectGarbage() no longer has any effect; the consumed memory keeps increasing over time:
Attachments
Issue Links
- duplicates
-
QTBUG-132931 QJSEngine leaks memory
-
- Closed
-