Kotlin under the hood: Understand the internals
summary
Kotlin compiles down to JVM bytecode you can inspect with Android Studio’s Bytecode/Decompile view, and the Memory Profiler reveals real allocations — a loop of 10,001 boxed Ints produces exactly 9,873 Integer allocations because -128..127 are cached. Enums create compiler-generated mapping arrays per when, lazy uses property-delegate/KProperty arrays but avoids reflection via intrinsics, unsigneds are usually free but box for toString, SAM lambdas wrap and can break removeListener, default params use bitmask ints, and coroutines become a label-based state machine.
AI-written summary · about
chapters (18)
- 0:00Intro
- 1:10Kotlin is Awesome
- 1:52Goals
- 2:17The Tools
- 2:43Example: Primitive Types
- 3:52Kotlin Bytecode
- 6:42Bytecode Decompiler
- 7:16Memory Profiler
- 12:03Example: when
- 19:23Example: Lazy Properties
- 21:04Example: Unsigned
- 24:18Example: Ranges
- 27:38Example: Inline classes
- 29:23Example: Arrays Java
- 30:37Example: Lambdas
- 32:37Example: Extension Functions
- 34:23Example: Default Parameters
- 37:11Example: Coroutines








