Tadeas Kriz
05/10/2024, 7:02 PMKotlinToolRunner
and it's companion object's property isolatedClassLoadersMap
.
Kotlin/Native uses KotlinToolRunner
to create a new URLClassLoader
with the kotlin-native-compiler-embeddable.jar
file. When multiple Gradle builds reuse the same Gradle daemon, but use different Kotlin versions, the kotlin-native-compiler-embeddable.jar
is loaded to memory for each of those. From our testing it's about 8 thousand classes per each and quickly leads to consuming all of metaspace. For some reason it doesn't get garbage collected and stays in the Gradle daemon's memory.
Is this an expected behavior where Kotlin/Native essentially "caches" these classes in the daemon, or is the expectation these would be deallocated?tapchicoma
05/11/2024, 8:30 AMIs this an expected behavior where Kotlin/Native essentially "caches" these classes in the daemonYes, the idea is to keep these classes between builds to improve performance. We are redoing this part in the 2.0.20 release, though please open a Kotlin issue for this.
tapchicoma
05/13/2024, 11:02 AM