Track your memory allocation
summary
Implements a custom global allocator that instruments malloc via the GlobalAlloc API, records stacks and emits a memory flamegraph HTML, so you see exact callsites and bytes. Demos show surprising hotspots: regex compilation costing multiple megabytes, sqlx connection pool causing ~35 KB total with ~5 KB per request. Works end-to-end for Rust allocations, with caveats: requires a configured maximum buffer, and logging/reentrancy around allocation causes runtime bugs to handle.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 3:43Memory allocation challenges
- 6:18Stack vs heap allocation
- 10:04Memory tools and concepts
- 13:25Rust’s allocation primitives
- 16:41Custom global allocator
- 19:59Demo: custom allocator
- 24:04Tracking allocations with flame graphs
- 26:59Live demo: memory tracking
- 31:02Dependency memory usage
- 34:42Production takeaways
- 36:09Q&A
related talks
29mWrangling memory leaks where you thought they could never happen
26mAllocating Less: Really Thin Rust Cloud Apps
57mDynamic memory allocation challenges in safety critical systems
01h 03mTaming dynamic memory
32mThe Impact of Memory Allocators on Performance: A Deep Dive
05mInterview
42mWhat’s Eating my RAM? - C++ Memory Management
54mAllocating Less: Really Thin Rust Cloud Apps
