From 753d9f4be5960be8b11ad067b29fc87c168ee663 Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Fri, 11 May 2012 11:28:24 +1000 Subject: [PATCH] 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 Reviewed-by: Aaron Kennedy --- src/qml/qml/qqmlengine.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index f948c31..107e0b5 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; -- 2.7.4