From 566be0995d184cd2c3f99d006ffb7249aeff2e57 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 10 Oct 2013 10:26:39 +0200 Subject: C++: Release more documents. - fix memory leak in find-usages - do not retain snapshot in search history - when an editor is invisible for more than 2 minutes, release the backing snapshot Retaining snapshots will retain their documents, and if done for too long, the memory consumption might grow. This is especially the case when switching to a different kit (Qt version): in that case, the new versions of headers will be indexed, while the old ones stay around. Task-number: QTCREATORBUG-5583 Task-number: QTCREATORBUG-7645 Task-number: QTCREATORBUG-9842 Change-Id: I045eda1565e0a3fa702baeffaab9c12662f90289 Reviewed-by: Erik Verbruggen Reviewed-by: Nikolai Kosjar --- src/plugins/cpptools/cpptoolseditorsupport.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/plugins/cpptools/cpptoolseditorsupport.h') diff --git a/src/plugins/cpptools/cpptoolseditorsupport.h b/src/plugins/cpptools/cpptoolseditorsupport.h index 838b8cab4f..02beb1d295 100644 --- a/src/plugins/cpptools/cpptoolseditorsupport.h +++ b/src/plugins/cpptools/cpptoolseditorsupport.h @@ -148,6 +148,9 @@ private slots: void updateEditor(); void updateEditorNow(); + void onCurrentEditorChanged(); + void releaseResources(); + private: struct EditorUpdates { EditorUpdates() @@ -160,7 +163,8 @@ private: enum { UpdateDocumentDefaultInterval = 150, - UpdateEditorInterval = 300 + UpdateEditorInterval = 300, + EditorHiddenGCTimeout = 2 * 60 * 1000 // 2 minutes }; private: @@ -178,6 +182,9 @@ private: unsigned m_revision; QFuture m_documentParser; + QTimer *m_editorGCTimer; + bool m_editorVisible; + // content caching mutable QMutex m_cachedContentsLock; mutable QByteArray m_cachedContents; -- cgit v1.2.1