Installazione:Come eseguire valgrind con l'esempio di base c?
bzip2 -d valgrind-3.10.1.tar.bz2
tar -xf valgrind-3.10.1.tar
poi:
./configure
make
make install
o più semplice
sudo apt-get install valgrind
Come eseguire Valgrind su quel semplice example1.c programma
#include <stdlib.h>
int main()
{
char *x = malloc(100); /* or, in C++, "char *x = new char[100] */
return 0;
}
Run:
valgrind --tool=memcheck --leak-check=yes example1
valgrind: example1: command not found
uscita dalla console:
valgrind: example1: command not found