aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlengine.cpp
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2012-05-11 11:28:24 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-12 00:06:33 +0200
commit753d9f4be5960be8b11ad067b29fc87c168ee663 (patch)
tree32167a43838da364be79f9d9b039e586dec77ff7 /src/qml/qml/qqmlengine.cpp
parent5570040771ec610583473e2d9e8e069474364cf1 (diff)
Dispose the v8object handle in QQmlData::destroy()
Previously, the handle was simply cleared, which meant that the data referenced by the handle would only be destroyed during the next garbage collection cycle. That had the unwanted side effect that v8's gc heuristics would assume that the old pointer space needed expansion more regularly than is required in truth, which has the further effect of slowing down mark-sweep-compact cycles considerably. Change-Id: I41595a4d79a75866f434c371139e5493e757d6ab Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlengine.cpp')
-rw-r--r--src/qml/qml/qqmlengine.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index f948c31352..107e0b5fed 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -1323,7 +1323,12 @@ void QQmlData::destroyed(QObject *object)
if (extendedData)
delete extendedData;
- v8object.Clear(); // The WeakReference handler will clean the actual handle
+ // Dispose the handle.
+ // We don't simply clear it (and wait for next gc cycle to dispose
+ // via the weak qobject reference callback) as this affects the
+ // outcomes of v8's gc statistical analysis heuristics, which can
+ // cause unnecessary growth of the old pointer space js heap area.
+ qPersistentDispose(v8object);
if (ownMemory)
delete this;