aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypeloader_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2017-06-29 14:56:05 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2017-08-02 18:15:17 +0000
commita4be64a06c94765f995d49be00eb8fc9bed83958 (patch)
tree07df008d0e22c955050a3b6f174bba2945b9efa6 /src/qml/qml/qqmltypeloader_p.h
parentd28e7e47e0ddcbb889ced731f8666996caf045b1 (diff)
Reduce memory consumption of stat() cache in QML type loader
The m_importDirCache caches the result of QDir/File::exists across paths. By changing the data structure to a QCache we impose a limit on the size of the entries and thus the memory consumption for long running programs that access many qml files. Task-number: QTBUG-61536 Change-Id: I20c4dc77260fe353c13da570b7e1bbd3f47d4b79 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltypeloader_p.h')
-rw-r--r--src/qml/qml/qqmltypeloader_p.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h
index 762fcdac65..05923f77e8 100644
--- a/src/qml/qml/qqmltypeloader_p.h
+++ b/src/qml/qml/qqmltypeloader_p.h
@@ -55,6 +55,7 @@
#include <QtCore/qobject.h>
#include <QtCore/qatomic.h>
#include <QtCore/qfileinfo.h>
+#include <QtCore/qcache.h>
#if QT_CONFIG(qml_network)
#include <QtNetwork/qnetworkreply.h>
#endif
@@ -362,8 +363,7 @@ private:
typedef QHash<QUrl, QQmlTypeData *> TypeCache;
typedef QHash<QUrl, QQmlScriptBlob *> ScriptCache;
typedef QHash<QUrl, QQmlQmldirData *> QmldirCache;
- typedef QStringHash<bool> StringSet;
- typedef QStringHash<StringSet*> ImportDirCache;
+ typedef QCache<QString, QCache<QString, bool> > ImportDirCache;
typedef QStringHash<QQmlTypeLoaderQmldirContent *> ImportQmlDirCache;
QQmlEngine *m_engine;