~/talk

Kotlin Multiplatform: Memory management old and new way

Talkat Android Worldwide 2022 · 2022-01-25..01-26· [kotlin]
slides:none on file

Explains concrete failures and fixes when sharing objects across threads in Kotlin Multiplatform: coroutines throw invalid-mutability or context-bound exceptions when switching between Dispatchers.default and main unless objects are made thread-safe; examples use freeze/unfreeze and Worker.start with futures and callbacks to show the invalid mutability exception and the atomic reference workaround; shows detached graph and background Worker use and how to return results to main; describes migration to new memory model (K/N 1.6) where freezing is removed and default dispatchers bind to iOS global queue, but notes library support, Xcode 12.5, and special coroutine branches are required.

AI-written summary · about

  1. 0:00Introduction
  2. 0:35Outline
  3. 1:58Common model
  4. 3:05Expect actual
  5. 8:17Android
  6. 9:10GVM
  7. 9:51Exception
  8. 11:11Magic command
  9. 12:26Why specify freeze
  10. 13:03Old solution
  11. 13:26Threading
  12. 15:18Native mechanism
  13. 16:28Sample code
  14. 16:54Android implementation
  15. 18:02Background worker
  16. 19:01void
  17. 19:12callback
  18. 20:20unfrozen
  19. 22:38fix code
  20. 23:46attached object craft
  21. 25:56channels flows
  22. 28:49iOS flow collector
  23. 29:45Kotlin flow wrapper
  24. 30:13Kotlin flow from iOS
  25. 30:39New memory management model
  26. 33:47Kotlin migration
  27. 34:38Transformation
  28. 35:26Data collection
  29. 35:48Default dispatchers
  30. 37:18UI dispatcher
  31. 38:03Single thread context
  32. 38:43Stable version of libraries
  33. 40:07Summary
  34. 42:01Questions
  35. 43:00Kotlin Multiplatform
  36. 44:51Atomic references
  37. 46:35Exception handling
  38. 47:52Using empty versions
  39. 49:40Should you learn Kotlin
  40. 50:15Using Kotlin with your native applications
  41. 52:35GitHub Tool
  42. 53:10Memory allocation
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.