http://parasol.tamu.edu measuring memory using valgrind csce 221h parasol lab, texas a&m...
TRANSCRIPT
http://parasol.tamu.edu
Measuring Memory using valgrind
CSCE 221H
Parasol Lab, Texas A&M University
valgrind
• Instrumentation framework for dynamic analysis of programs (http://valgrind.org/)
memcheck – detecting memory errorscachegrind – profiling cache / branch predictionhelgrind – detecting races in parallel programsmassif – profile memory allocation in heap / stack
2
massif - heapvalgrind --tool=massif --time-
unit=B ./a.out
3
ms_print massif.out.*
massif - stackvalgrind --tool=massif --time-
unit=B --stacks=yes ./a.out
4
ms_print massif.out.*
Exercise
1. Write an iterative version of the all_true algorithm• Measure memory consumption using massif of both the
iterative and recursive versions
2. Plot peak memory consumption for the following:• n = 101, 102, 103, 104, 105
5