Master the fundamental concepts of memory optimization through this focused micro-challenge.
Valgrind Massif records heap snapshots over time so you can see peak usage and which call stacks allocated it. Chrome's allocator telemetry and Rust's dhat serve the same goal: find leaks, spikes, and unexpected strdup hot paths.
Run with --tool=massif, open massif.out in ms_print or massif-visualizer. Look for stairs that never descend (leak) and sudden peaks (batch allocation).
bashLoading…
-g for symbolic stacks--pages-as-heap=yes includes mmap allocationsKeep the relevant documentation open while you implement. When your output disagrees with the reference, trace one failing case by hand before changing random lines.
You will run Massif on a program with deliberate allocation patterns and identify the top allocator stack. This exercise requires reporting peak bytes and the responsible function.
Demonstrate heap profiling with Valgrind Massif.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github