Prevent valgrind for checking memory leaking in shared libraries linked with our application

半腔热情 提交于 2020-01-24 20:56:34

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!