Kotlin Gradle in CI

I’ve got a multi-platform multi-project build in Kotlin, and it seems that for CI I have to give the docker container a lot of memory (8G+) to work. When it’s set to 2G the build runs very slowly (probably memory swapping?) and eventually fails.

In most cases I’m fine with just increasing the container’s memory, but for my own education I’d like to know if there are settings I should try.

Things I’ve tried:

  • playing with the jvm args heap size org.gradle.jvmargs
  • -XX:+UseContainerSupport -XX:MaxRAMPercentage=80
  • Setting kotlin compiler daemon options (-Dkotlin.daemon.jvm.options=-Xmx##) (Although it doesn’t always fail on compilation, could be during tests or other build steps)

I should mention that I don’t have a keen sense of what is “normal” here. 8GB might be normal for a project this size, but my gut is telling me something is probably wrong, especially considering that any individual project will compile fine, but as a whole in the multi-project build it will fail after a few minutes.
Perhaps a memory leak in the build that I don’t know how to troubleshoot.

Any advice is appreciated :slight_smile:

1 Like

Could be a memory leak. Can you please file an issue at http://kotl.in/issue with a link to a heap dump (some instructions here: https://youtrack.jetbrains.com/issue/KT-32990#focus=streamItem-27-3656134.0-0)?

Thanks. It will likely be more than a month for me to circle back to it as just giving it more memory is a good bandaid for now. I will add a ticket to my backlog. I didn’t know how to get a heap dump before so this might be helpful in troubleshooting.

N