CASE CLASSES ATE MY RAM
summary
Case-class instances and Scala collections often use huge hidden memory: tooling like Java Object Layout (JOL) and the jamm agent shows per-pageview overhead near 96 bytes → 19 bytes after packing, with roughly 90% of memory in object headers and references. A library called scala-packed serializes case classes into Array[Byte] via Shapeless-derived encoders, plugs into Scala’s collection builders, and implements packed lists and an open-addressing packed map; benchmarks show an order-of-magnitude RAM cut but some runtime overhead and fragility in complex schemas.
AI-written summary · about
chapters (7)
- 0:00Start
- 2:03QUIZ
- 5:47CASE CLASS MEMORY FOOTPRINT
- 8:52COLLECTION OF PRIMITIVES
- 10:34PERKS OF NATIVE MEMORY LAYOUT
- 15:02HOW IT WORKS: CASE CLASSES
- 19:51MAPS








