https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
a

Ahmed na

11/02/2023, 5:42 AM
Hi so 1.9.20 got released I noticed this about memory allocator , How can i enable it for kotlin 1.9.10 ? (i don't want to migrate to 1.9.20 as of now)
p

p-schneider

11/02/2023, 6:15 AM
https://kotlinlang.org/docs/whatsnew19.html#preview-of-custom-memory-allocator
-Xallocator=custom
Copy code
kotlin {
    macosX64("native") {
        binaries.executable()

        compilations.configureEach {
            compilerOptions.configure {
                freeCompilerArgs.add("-Xallocator=custom")
            }
        }
    }
}
🙌 2
a

Ahmed na

11/02/2023, 9:34 AM
Thanks ! @p-schneider , i applied it like this
Copy code
listOf(
        iosX64(),
        iosArm64(),
        iosSimulatorArm64()
    ).forEach {
        it.compilations.configureEach {
            compilerOptions.configure {
                freeCompilerArgs.add("-Xallocator=custom")
            }
        }
    }
This resolved over 200+ memory leaks ! , the ios team were scolding me over them 🥹
5 Views