Avoid retaining all protobuf objects in DeserializedMemberScope
Object model for deserialized protobuf isn't very cheap, so loading just our stdlib's packages several times (as we do in the IDE) might lead to ~ 96 MB of retained memory just by these objects. While in fact many of them remain unused #KT-21517 Fixed
This commit is contained in:
+2
-1
@@ -53,7 +53,8 @@ class JvmBuiltInsPackageFragmentProvider(
|
||||
),
|
||||
notFoundClasses,
|
||||
ContractDeserializer.DEFAULT,
|
||||
additionalClassPartsProvider, platformDependentDeclarationFilter
|
||||
additionalClassPartsProvider, platformDependentDeclarationFilter,
|
||||
BuiltInSerializerProtocol.extensionRegistry
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.load.java.lazy.LazyJavaPackageFragmentProvider
|
||||
import org.jetbrains.kotlin.platform.JvmBuiltIns
|
||||
import org.jetbrains.kotlin.serialization.deserialization.*
|
||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
|
||||
// This class is needed only for easier injection: exact types of needed components are specified in the constructor here.
|
||||
@@ -50,7 +51,8 @@ class DeserializationComponentsForJava(
|
||||
LocalClassifierTypeSettings.Default, errorReporter, lookupTracker, JavaFlexibleTypeDeserializer,
|
||||
emptyList(), notFoundClasses, contractDeserializer,
|
||||
additionalClassPartsProvider = jvmBuiltIns?.settings ?: AdditionalClassPartsProvider.None,
|
||||
platformDependentDeclarationFilter = jvmBuiltIns?.settings ?: PlatformDependentDeclarationFilter.NoPlatformDependent
|
||||
platformDependentDeclarationFilter = jvmBuiltIns?.settings ?: PlatformDependentDeclarationFilter.NoPlatformDependent,
|
||||
extensionRegistryLite = JvmProtoBufUtil.EXTENSION_REGISTRY
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user