# Testing the Kotlin Native memory model

DevFeed: [Testing the Kotlin Native memory model](<https://devfeed.tech/articles/testing-the-kotlin-native-memory-model-25954.md>)

Original publisher: [Read original article](<https://medium.com/@kpgalligan/testing-the-kotlin-native-memory-model-d3ccd2c2810f?source=rss-c2f810aa7890------2>)

Author: Kevin Galligan

Published: 2021-10-03T16:35:56Z

Content type: tutorial

Language: en

Sources: [Stories by Kevin Galligan on Medium](<https://devfeed.tech/sources/stories-by-kevin-galligan-on-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [kotlin-native](<https://devfeed.tech/topics/kotlin-native.md>), [GitHub Actions](<https://devfeed.tech/topics/github-actions.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Open Source](<https://devfeed.tech/topics/open-source.md>), [Xcode](<https://devfeed.tech/topics/xcode.md>), [macOS](<https://devfeed.tech/topics/macos.md>)

Tags: [build](<https://devfeed.tech/tags/build.md>), [github-actions](<https://devfeed.tech/tags/github-actions.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [kotlin-native](<https://devfeed.tech/tags/kotlin-native.md>), [macos](<https://devfeed.tech/tags/macos.md>), [memory](<https://devfeed.tech/tags/memory.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [testing](<https://devfeed.tech/tags/testing.md>), [xcode](<https://devfeed.tech/tags/xcode.md>)

## AI overview

A practical guide to testing Kotlin/Native's experimental new memory model. It explains how to enable the model through Gradle properties, run library tests across Kotlin versions and memory-model configurations, and report bugs using a sample project.

## Source excerpt

Memory joke Kotlin/Native's strict memory model has been a common topic of interest and/or concern in the community for some time. The arrival of the new memory model will remove what many consider an adoption blocker. However, creating and testing a new memory model is a significant undertaking. It is tempting to wait until the new memory model is "ready", but the community can help accelerate the maturing of the platform by testing the new model and reporting bugs. We are starting to run our open source library tests against the new memory model. Just turning it on for Kermit found a relatively minor issue. If you publish a library, it would be great if you could turn on the new memory model and see if things work. Although everybody's config is different, here's how we do it. Kermit's Kotlin version is in the gradle.properties file. GROUP=co.touchlab VERSION_NAME=1.0.0-rc4 KOTLIN_VERSION=1.5.31 # etc... Kermit/gradle.properties at main - touchlab/Kermit That makes turning on the memory model simple. We can pass in a different Kotlin version and memory model flag, both as gradle properties. Currently we run tests 3 times. First with Kotlin 1.5.31, which is our published version. Then Kotlin 1.6.0-M1, but with the strict memory model, then Kotlin 1.6.0-M1 and the new memory model. In the Github Actions script, here are the lines: - name: Build run: ./gradlew build --no-daemon --stacktrace - name: Build 1.6 run: ./gradlew build -PKOTLIN_VERSION=1.6.0-M1 --no-daemon --stacktrace - name: Build 1.6 nmm run: ./gradlew build -PKOTLIN_VERSION=1.6.0-M1 \ -Pkotlin.native.binary.memoryModel=experimental --no-daemon \ --stacktrace Param -PKOTLIN_VERSION=1.6.0-M1 sets the Kotlin verison, and -Pkotlin.native.binary.memoryModel=experimental turns on the new memory model. Also FYI, macos-latest is a little old and has Xcode 12.4. macos-11 has Xcode 12.5, which is required for Kotlin 1.6.0-M1. Obviously, if you run those once and they work fine, you don't need to leave them on. We