PUBLIC OBJECT

GC You Later, Allocator

I presented this at Droidcon NYC on September 19, 2024.

Available as code, video, slides, Droidtube, & Speaker Deck.



Memory management on Android is easy: the garbage collector does almost everything and LeakCanary handles the rest! But Kotlin/Multiplatform brings new challenges. Your new features could be blocked if Kotlin/Native leaks memory.

In this talk you’ll get a refresher on Android's garbage collector, and you’ll learn how Swift works without one. Once that groundwork is laid you’ll see how Kotlin/Native integrates these two models.

We’ll cover some memory management tools & techniques:

  • Using Xcode to see what’s leaking
  • Avoiding leaks when mixing Kotlin and Swift
  • Using PhantomReference to test memory bugs
  • How Kotlin inline classes compare to Valhalla’s primitive classes.

If you’d like to improve memory management in a multiplatform app, this talk is for you.