2
valgrind-3.6.0.SVN-Debian
gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
2.6.35-22-generic

I am using valgrind to detect memory errors in our code.

However, are application uses some third party libraries (shared library). When we start to capture using valgrind. It goes into this library, and displays many memory errors with this library. So it is difficult to check our application due to this. There is many to go through.

It is possible to configure valgrind to only check our source code and not go into the shared libraries?

Is there any other open source memory checking software that can do this if valgrind cannot?

Many thanks for any suggestions,

ant2009
  • 27,094
  • 154
  • 411
  • 609

2 Answers2

4

You can try suppressing the errors generated by the library code:

http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress

Tony
  • 9,672
  • 3
  • 47
  • 75
2

It's entirely possible that errors reported in library code are actually due to bugs in your calling code.

For example, if you pass a bad pointer or a short buffer to library code, you might cause access errors in that code; or if the library code provides a resource deallocation function that your code neglects to call, you might cause memory leak reports traced back to the library code.

caf
  • 233,326
  • 40
  • 323
  • 462
  • I tested the library by linking with it and just calling a few api functions. However, I don't think there is anything in our code that is causing a problem with the library. As our test application is just a skeleton application at the moment. Thanks. – ant2009 Jan 14 '11 at 08:45
  • @ant2009: No worries, just something to consider. If you can demonstrate the problems with a simple test program, then you should probably report them as bugs to the library authors. – caf Jan 14 '11 at 08:50
  • I think the library does some very low stuff. And I don't think the libraries authors would even consider them as bugs. But thanks anyway. – ant2009 Jan 14 '11 at 10:50
  • @ant2009: Sounds a bit dubious to me (depending on what the Valgrind errors are, anyway). – caf Jan 15 '11 at 06:13