What we have learned about memory profiling in the last 5 years
summary
Retrospective lists concrete tooling and workflows: collect runtime events with +RTS -l, visualize heap bands and per-closure counts with eventlog2html, and drill precise retainers with GHC debug (break/snapshot mode). Use -hT for closure-type counts, -hI plus an info table map to get per-thunk source locations (bigger binaries and slower compilation). Era profiling tags allocations to track lifetimes. Event-log traces add almost no overhead; profiling runtime helps time/cost-centre work but not heap heat maps. A 100-path retainer query can take ~23s in the demo.
AI-written summary · about
chapters (15)
- 0:00Memory profiling in Haskell
- 1:08Five years of progress
- 5:23Axes of memory tools
- 8:15Memory invariants
- 14:53Event log fundamentals
- 19:06Heap profiling with EventLogToHTML
- 25:25Closure types basics
- 28:56Closure type profiling
- 33:52Heap analysis with EventLogToHTML
- 41:16User traces correlation
- 46:45Info table profiling
- 56:37Profiling by era
- 1:02:10GHC Debug
- 1:18:48Tool adoption challenges
- 1:23:00Summary and future
related talks
41mPinpointing memory leaks in production Haskell deployments
30mLightweight profiling with ghc-stack-profiler
01h 02mOptimising for fast builds with GHC
01h 30mGHC's Runtime System
26mghc-specter: a GHC plugin that inspects the GHC state on live
15mUsing MMTk Garbage Collection in GHC (Lightning Talk)
18mInvestigating Magic Numbers: Improving the Inlining Heuristic in the Glasgow ...
32mCode as Data: Extracting & Analyzing Info from Haskell Codebases
