https://kotlinlang.org logo
#k2-early-adopters
Title
# k2-early-adopters
d

dniHze

04/01/2024, 8:09 AM
We noticed, that our test suite is constantly reaching OOM error on CI in our benchmarks run. However, it passes just fine on the latest stable K1. Looks like it runs out of meta space on subsequent runs (from 3rd to 5th). The Gradle daemon is stopped before each run, so not sure what's going on there. More details in the thread.
Looks like it fails in particular on KSP processing. And it may happen on any run. Might be because KSP still technically uses K1 under the hood, but that's my uneducated guess.
Also, we do not set custom JVM params for the Kotlin compiler daemon, if that helps. Our current settings for the Gradle daemon are:
org.gradle.jvmargs=-Xmx12g -XX:MaxMetaspaceSize=1g -XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
e

eygraber

04/01/2024, 8:46 AM
Did you update KSP to v2? If so it's expected to use more memory because it's in process instead of in the Kotlin daemon. From the blog post:
Note: You might need to enlarge the heap size of the Gradle daemon now that KSP and processors run in the Gradle daemon instead of the Kotlin compiler’s daemon
d

dniHze

04/01/2024, 9:55 AM
Not really, it didn't work out for us with Dagger. We ran into problems on our initial try. Also, it's a little sus, that it only happens during test runs, and not during different app build flavors benchmarks.
t

tapchicoma

04/02/2024, 3:23 PM
would be helpful to do a heap dump on OOM and either analyse it yourself or upload it to us via https://uploads.jetbrains.com/ (need to tell use the id of the upload)