Http://parasol.tamu.edu Measuring Memory using valgrind CSCE 221H Parasol Lab, Texas A&M University.
-
Upload
allan-wright -
Category
Documents
-
view
217 -
download
2
Transcript of Http://parasol.tamu.edu Measuring Memory using valgrind CSCE 221H Parasol Lab, Texas A&M University.
![Page 1: Http://parasol.tamu.edu Measuring Memory using valgrind CSCE 221H Parasol Lab, Texas A&M University.](https://reader036.fdocuments.net/reader036/viewer/2022082709/56649f495503460f94c6af20/html5/thumbnails/1.jpg)
http://parasol.tamu.edu
Measuring Memory using valgrind
CSCE 221H
Parasol Lab, Texas A&M University
![Page 2: Http://parasol.tamu.edu Measuring Memory using valgrind CSCE 221H Parasol Lab, Texas A&M University.](https://reader036.fdocuments.net/reader036/viewer/2022082709/56649f495503460f94c6af20/html5/thumbnails/2.jpg)
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
![Page 3: Http://parasol.tamu.edu Measuring Memory using valgrind CSCE 221H Parasol Lab, Texas A&M University.](https://reader036.fdocuments.net/reader036/viewer/2022082709/56649f495503460f94c6af20/html5/thumbnails/3.jpg)
massif - heapvalgrind --tool=massif --time-
unit=B ./a.out
3
ms_print massif.out.*
![Page 4: Http://parasol.tamu.edu Measuring Memory using valgrind CSCE 221H Parasol Lab, Texas A&M University.](https://reader036.fdocuments.net/reader036/viewer/2022082709/56649f495503460f94c6af20/html5/thumbnails/4.jpg)
massif - stackvalgrind --tool=massif --time-
unit=B --stacks=yes ./a.out
4
ms_print massif.out.*
![Page 5: Http://parasol.tamu.edu Measuring Memory using valgrind CSCE 221H Parasol Lab, Texas A&M University.](https://reader036.fdocuments.net/reader036/viewer/2022082709/56649f495503460f94c6af20/html5/thumbnails/5.jpg)
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