Analyzing and Reducing Ruby Memory Usage
summary
Covers practical measurement with malloc stack logging (macOS) and the AllocationTracer gem, then implements two Ruby 2.6 patches: feature cache patch and direct instruction marking. The feature cache change avoids creating many Ruby string objects and cuts string count ~45% and a simple Rails startup’s memory ~42%. Direct instruction marking removes the long IC mark array (IC entries drop ~34%) and yields about a 6% process memory reduction in the sample Rails app.
AI-written summary · about
chapters (11)
- 0:00Introduction and self-introduction
- 3:01Ruby 2.6 memory optimizations
- 8:48Finding memory usage with tools
- 15:48Optimizing string allocations
- 19:14Feature cache optimization results
- 20:50Bytecode and VM internals
- 25:47Bytecode compilation process
- 32:33Memory reduction in bytecode
- 37:30Direct marking optimization
- 38:54Impact of direct marking
- 40:00Summary and call to upgrade
related talks
45mClosing Keynote: Analyzing and Reducing Ruby Memory Usage
39mPointers for Eliminating Heaps of Memory
29mWhat causes Ruby memory bloat?
34mHow to optimize Ruby internal.
46mRuby Memory Management Hacks
46mHalve Your Memory Usage With These 12 Weird Tricks
29mTidying Active Record Allocations
27mParallel Ruby: Managing the Memory Monster
