diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-04-18 15:14:26 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-04-19 08:09:21 +0000 |
commit | 23e0e26ce652cf360310ebb1e2de8283502eba2e (patch) | |
tree | e07a5078f8021daca56ba7efca0b5f672e7b2f4a /src/qml/qml/qqmltypeloader_p.h | |
parent | cf28f909da1145b8f4fbb92a3bf8353d5f397f97 (diff) |
Occasionally trim the type cache
As loaded components are kept in a cache, they are never removed by the
garbage collector. So, if you periodically create new components, they
leak. This change adds a floating threshold for the number of
components. When that threshold is surpassed trimCache() is called and
unneeded components are removed.
Task-number: QTBUG-42055
Change-Id: I30e3e4ee287f6d34376713668009c67614a50e0c
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/qml/qqmltypeloader_p.h')
-rw-r--r-- | src/qml/qml/qqmltypeloader_p.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h index 6433601ba8..f565bcd31f 100644 --- a/src/qml/qml/qqmltypeloader_p.h +++ b/src/qml/qml/qqmltypeloader_p.h @@ -358,6 +358,7 @@ private: QQmlTypeLoaderThread *m_thread; NetworkReplies m_networkReplies; TypeCache m_typeCache; + int m_typeCacheTrimThreshold; ScriptCache m_scriptCache; QmldirCache m_qmldirCache; ImportDirCache m_importDirCache; @@ -365,6 +366,7 @@ private: template<typename Loader> void doLoad(const Loader &loader, QQmlDataBlob *blob, Mode mode); + void updateTypeCacheTrimThreshold(); friend struct PlainLoader; friend struct CachedLoader; |