(part of IJPL-220534) clean internal datastructures holding references to services on dispose, to make memdumps shorter and memleaks more revealing

GitOrigin-RevId: 8b506d01038c709b097571b32c5d81f8f557cf9c
This commit is contained in:
Alexey Kudravtsev
2026-01-08 13:36:18 +00:00
committed by intellij-monorepo-bot
parent f8ffdf7da7
commit 66f4aad23f
@@ -1185,6 +1185,7 @@ abstract class ComponentManagerImpl(
if (!containerState.compareAndSet(ContainerState.DISPOSED, ContainerState.DISPOSE_COMPLETED)) {
throw IllegalStateException("Expected current state is DISPOSED, but actual state is ${containerState.get()} ($this)")
}
pluginServicesStore.clearPotentialLeaks()
}
override fun stopServicePreloading() {
@@ -1421,6 +1422,11 @@ private class PluginServicesStore {
fun removeDynamicServices(descriptor: IdeaPluginDescriptor): List<InstanceHolder> {
return dynamicServices.remove(descriptor)?.toList() ?: java.util.List.of()
}
fun clearPotentialLeaks() {
dynamicServices.clear()
regularServices.clear()
}
}
private fun createPluginExceptionIfNeeded(error: Throwable, pluginId: PluginId): RuntimeException {