问题
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,
回答1:
You can try suppressing the errors generated by the library code:
http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress
回答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.
来源:https://stackoverflow.com/questions/4689046/prevent-valgrind-for-checking-memory-leaking-in-shared-libraries-linked-with-our