...
First, add the valgrind plugin to your eclipse installation:
Then build the code (attached to this wiki page as stream.c ). Set it up as a new c project and add "-fopenmp" to the compile and link settings under the project properties if you want pthread/OpenMP support compiled in (we'll run it that way for the demo).
After building the project, try profiling it with valgrind. There are a couple options to explore. The default is to check for memory leaks.
It's normal for valgrind to flag the pthread_create system call associated with the OpenMP directives. Try uncommenting one of the free() lines near the end of main() , rebuild and profile again.
This time, notice valgrind has marked a line of the code with a malloc(). Since there's no corresponding free for that memory, valgrind throws an error.
References: