From 1357e2b4d5528452226063bc2f5e7780b756e53a Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 10 Mar 2014 20:28:02 +0100 Subject: [PATCH] use a more memory-efficient structure to hold a long indexed file list --- .../com/intellij/openapi/project/CacheUpdateSession.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateSession.java b/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateSession.java index 7b6f8ae021bd..bb715b480dfa 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateSession.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateSession.java @@ -33,7 +33,7 @@ import java.util.*; public class CacheUpdateSession { private static final Logger LOG = Logger.getInstance("#" + CacheUpdateSession.class.getName()); private static final Key FAILED_TO_INDEX = Key.create(CacheUpdateSession.class.getSimpleName() + ".FAILED_TO_INDEX"); - private final Collection myFilesToUpdate; + private final List myFilesToUpdate; private final int myJobsToDo; private final List>> myUpdatersWithFiles = new ArrayList>>(); @@ -41,7 +41,7 @@ public class CacheUpdateSession { public CacheUpdateSession(Collection updaters, ProgressIndicator indicator) { List processedUpdaters = new ArrayList(); - myFilesToUpdate = new LinkedHashSet(); + LinkedHashSet set = ContainerUtil.newLinkedHashSet(); try { int jobsCount = 0; for (CacheUpdater each : updaters) { @@ -50,7 +50,7 @@ public class CacheUpdateSession { jobsCount += each.getNumberOfPendingUpdateJobs(); List updaterFiles = Arrays.asList(each.queryNeededFiles(indicator)); processedUpdaters.add(each); - myFilesToUpdate.addAll(updaterFiles); + set.addAll(updaterFiles); myUpdatersWithFiles.add(Pair.create(each, (Collection)new THashSet(updaterFiles))); } catch (ProcessCanceledException e) { @@ -68,6 +68,7 @@ public class CacheUpdateSession { } throw e; } + myFilesToUpdate = ContainerUtil.newArrayList(set); } public int getNumberOfPendingUpdateJobs() {