The Mutability Matrix of Pain: An Accessible Exploration of the JVM Heap
summary
Explains the JVM memory model with concrete rules: mutability matrix of pain (final vs non‑final reference crossed with mutable vs immutable value) and why non‑final→mutable forces locks. Shows volatile on last field as a cheaper memory‑barrier trick to publish multiple field updates, and that actors (Akka) give a happens‑before per message. Covers costs: synchronized contended locks cause context switches; writing back to main memory can be ~66 ns; immutability via Scala case class copy increases GC pressure. Recommends jHiccup for jitter and to avoid >4GB heap with CMS/G1.
AI-written summary · about
chapters (9)
- 0:00Introduction to JVM memory
- 2:26Java heap and shared state
- 9:24Concurrency vs parallelism
- 12:55Value identity and state
- 19:40Mutability matrix explained
- 23:36Volatile and synchronization
- 29:14Immutable data strategies
- 33:29Garbage collection tuning
- 36:06Q&A
related talks
27mThe Mutability Matrix of Pain
40mA practical approach to Java Memory Model
22mJava Memory Model
45mJava Memory Consistency Model
49mTrash Talk - Exploring the memory management in the JVM
51mTrash Talk - Exploring the JVM memory management
36mConcurrency — Java Memory Model — Not Just for Eagles
41m"Change is the Only Constant”. Really?
