Avoid calling gc in QQmlEngine destructor.
authorJędrzej Nowacki <jedrzej.nowacki@nokia.com>
Thu, 19 Apr 2012 12:38:38 +0000 (14:38 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 27 Apr 2012 08:38:58 +0000 (10:38 +0200)
commitb765e3a84bc531878a5cc0d451451a94565b13f8
tree4c506d229c76924a2c72de31464efa8b440f005f
parent7ec674ee9a8e51cb1cb7ef60b1d27845349b8dec
Avoid calling gc in QQmlEngine destructor.

GC may be expensive. GC call in QQmlEngine doesn't have much sense
because V8 will destroy all objects living in a current context.
The only problem is that V8 may decide to not invoke weak callbacks
which may cause a memory leak. To avoid that we track all QObjects that
have JavaScript ownership set and we delete them explicitly.

The change reduce time of destroying QQmlEngine by 75%, which is really
visible in qquicklistmodel test.

Change-Id: I2a3668fd23630669114baee8c241a7ecc4100e33
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
src/qml/qml/qqmlengine.cpp
src/qml/qml/v8/qv8engine_p.h
src/qml/qml/v8/qv8objectresource_p.h [new file with mode: 0644]
src/qml/qml/v8/qv8qobjectwrapper.cpp
src/qml/qml/v8/qv8qobjectwrapper_p.h
src/qml/qml/v8/v8.pri
tests/auto/qml/qjsengine/tst_qjsengine.cpp
tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
tests/auto/qml/qqmlengine/tst_qqmlengine.cpp