From 26714d56d8df62cee78be86671a71908edc5d011 Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Thu, 29 Mar 2018 15:03:53 +0200 Subject: [PATCH] Use WeakKeySoftValueMap in ResolveElementCache Otherwise results are effectively retained in the maps until we're close to OutOfMemory. While we mostly need them for a short time (especially in the case we run resolution during usages search). The possible problem is that the values may become too short-living, but now using these maps is a conventional solution for similar tasks in Java resolve --- .../org/jetbrains/kotlin/idea/project/ResolveElementCache.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/ResolveElementCache.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/ResolveElementCache.kt index 6303bee5564..6cfc43274cb 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/ResolveElementCache.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/ResolveElementCache.kt @@ -77,7 +77,7 @@ class ResolveElementCache( CachedValuesManager.getManager(project).createCachedValue( CachedValueProvider> { CachedValueProvider.Result.create( - ContainerUtil.createConcurrentSoftValueMap(), + ContainerUtil.createConcurrentWeakKeySoftValueMap(), PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, resolveSession.exceptionTracker ) @@ -103,7 +103,7 @@ class ResolveElementCache( CachedValuesManager.getManager(project).createCachedValue( CachedValueProvider> { CachedValueProvider.Result.create( - ContainerUtil.createConcurrentSoftValueMap(), + ContainerUtil.createConcurrentWeakKeySoftValueMap(), PsiModificationTracker.MODIFICATION_COUNT, resolveSession.exceptionTracker )