Parallel Ruby: Managing the Memory Monster
summary
Claim: switching many single‑threaded Ruby processes to a threadpool causes runaway memory from OS‑heap fragmentation, not a Ruby object leak. Evidence: a 20‑thread demo that allocates 1MB per thread spikes past 1GB; setting MALLOC_ARENA_MAX=2 cuts usage to ~600–700MB; rebuilding Ruby with jemalloc reduces it further and reports ~15% memory and occasional 11% speed gains. Actionable outcome: change allocator or arena limit; the fixes stop the growth.
AI-written summary · about
chapters (6)
- 0:00Start
- 0:53We run a lot of background jobs
- 1:48The Great Migration
- 3:33Side Lesson
- 14:49Option 2: Use a Different Memory Allocator
- 16:54So... What should you do?
related talks
29mWhat causes Ruby memory bloat?
39mAngelina Ballerina Learns About Memory Allocation
39mPointers for Eliminating Heaps of Memory
45mClosing Keynote: Analyzing and Reducing Ruby Memory Usage
46mRuby Memory Management Hacks
27mOptimizing Ruby's Memory Layout
46mHalve Your Memory Usage With These 12 Weird Tricks
36mThere and Back Again
