0Pricing
Kotlin Academy · Lesson

Memory Management in Kotlin/Native: The New MM

Explore the new Kotlin/Native memory manager, GC, and object ownership.

The Old Memory Model Problem

Kotlin/Native's original memory model (pre-1.7.20) was "immutable by default": objects had to be frozen before crossing thread boundaries. This made multi-threaded code cumbersome and incompatible with Kotlin coroutines semantics.

The New Memory Manager (1.7.20+)

Since Kotlin 1.7.20, Kotlin/Native uses a new garbage-collected memory model that mirrors the JVM/JS behaviour. Object mutation across threads is allowed by default. The freeze() / isFrozen APIs are deprecated and no-ops.

All lessons in this course

  1. Kotlin/Native Overview: Targets, Toolchain & Compilation
  2. Memory Management in Kotlin/Native: The New MM
  3. C Interop with cinterop and .def Files
  4. Kotlin/WASM: Compiling to WebAssembly for the Browser
← Back to Kotlin Academy