Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

First, add the valgrind plugin to your eclipse installation: Image Added

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. Image Added

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. Image Added

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. Image Added

References:

http://www.eclipse.org/linuxtools/projectPages/valgrind/Image Removed