From: Chris Adams Date: Fri, 11 May 2012 01:28:24 +0000 (+1000) Subject: Dispose the v8object handle in QQmlData::destroy() X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=753d9f4be5960be8b11ad067b29fc87c168ee663;p=konrad%2Fqtdeclarative.git 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 --- 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;