From 2d27c5531027368eaa41d26ced4dceb936f9c7a3 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 28 Jul 2017 15:15:46 +0200 Subject: Clang: Suspend least recently used translation units ...to free some memory. The translation units of the 7 most recently used documents ("hot documents", tracked by document visibility) are kept in memory. Translation units of other documents are suspended and will be resumed once they become visible again. The resumption of a translation unit needs the same time as reparse (since it is a reparse effectively). The number of hot documents can be modified by the run time environment variable QTC_CLANG_HOT_DOCUMENTS=N. Visible documents are always hot. Task-number: QTCREATORBUG-11640 Change-Id: I68ecd2b1373e303372300203e42d90f65a4b39b3 Reviewed-by: Ivan Donchevskii Reviewed-by: Marco Bubke --- src/tools/clangbackend/ipcsource/clangdocument.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/tools/clangbackend/ipcsource/clangdocument.cpp') diff --git a/src/tools/clangbackend/ipcsource/clangdocument.cpp b/src/tools/clangbackend/ipcsource/clangdocument.cpp index 933bf61276..a4f95d17b8 100644 --- a/src/tools/clangbackend/ipcsource/clangdocument.cpp +++ b/src/tools/clangbackend/ipcsource/clangdocument.cpp @@ -80,6 +80,7 @@ public: bool isUsedByCurrentEditor = false; bool isVisibleInEditor = false; bool increaseResponsiveness = false; + bool isSuspended = false; }; DocumentData::DocumentData(const Utf8String &filePath, @@ -226,6 +227,20 @@ void Document::setResponsivenessIncreaseNeeded(bool responsivenessIncreaseNeeded d->increaseResponsiveness = responsivenessIncreaseNeeded; } +bool Document::isSuspended() const +{ + checkIfNull(); + + return d->isSuspended; +} + +void Document::setIsSuspended(bool isSuspended) +{ + checkIfNull(); + + d->isSuspended = isSuspended; +} + bool Document::isUsedByCurrentEditor() const { checkIfNull(); -- cgit v1.2.1