IR: clear callToSubstitutedDescriptorMap for each file to avoid leaking memory
This map is populated during psi2ir and is only used in insertImplicitCasts, after which it makes sense to clear it, otherwise it strongly references a lot of descriptors for calls in other files which would never be used.
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ class GeneratorContext(
|
||||
val constantValueGenerator: ConstantValueGenerator,
|
||||
override val irBuiltIns: IrBuiltIns
|
||||
) : IrGeneratorContext {
|
||||
val callToSubstitutedDescriptorMap = mutableMapOf<IrDeclarationReference, CallableDescriptor>()
|
||||
internal val callToSubstitutedDescriptorMap = mutableMapOf<IrDeclarationReference, CallableDescriptor>()
|
||||
|
||||
val sourceManager = PsiSourceManager()
|
||||
|
||||
|
||||
@@ -90,7 +90,10 @@ class ModuleGenerator(
|
||||
}
|
||||
|
||||
irFile.acceptChildrenVoid(IrSyntheticDeclarationGenerator(context))
|
||||
|
||||
insertImplicitCasts(irFile, context)
|
||||
context.callToSubstitutedDescriptorMap.clear()
|
||||
|
||||
irFile.acceptVoid(AnnotationGenerator(context))
|
||||
|
||||
irFile.patchDeclarationParents()
|
||||
|
||||
Reference in New Issue
Block a user