Escape analysis failure:
Please try to disable escape analysis and rerun the build. To do it add the following snippet to the gradle script:

    kotlin.targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget> {
        binaries.all {
            freeCompilerArgs += "-Xdisable-phases=EscapeAnalysis"
        }
    }

In case of using command line compiler add this option: "-Xdisable-phases=EscapeAnalysis".
Also, consider filing an issue with full Gradle log here: https://kotl.in/issue

Java heap space
java.lang.OutOfMemoryError: Java heap space