Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
5.15.6, 6.3.1
Description
Try run the attached project. You'll notice that every loop iteration, there is at least 100000 (as set by the number of iterations in main.qml) instances of MyObject live.
This is extraordinarily high, considering the objects are under JS ownership (due to being returned from C++ with no pointer), and unused after each iteration of the loop.
What is interesting is that by setting QT_LOGGING_RULES="qt.qml.gc*=true", it is possible to see that multiple GCs run during the loop, but nothing "extra" above that loop count is ever freed. Playing with an explicit gc() after the loop, or QQmlEngine::setObjectOwnership() doesn't seem to change anything.
Not sure exactly where the blame for this lies - the allocation isn't coming directly from the GC, after all, but since the objects should have JS ownership, I would expect them to be freed at some point, ideally even on the GCs during the loop's running.