开发者

Valgrind memcheck programmatic enable

I don't suppose there is a way to programmatically enable/disable Valgrind memcheck the way you can with callgrind? (开发者_开发知识库Start/stop instrumentation).

It's painfully, unusably slow (which is okay if the code you want to test starts automatically and you just leave it running), but I can't actually get into the code that's important without clicking a few buttons in the app, which is rendered completely unresponsive. (My code is a plug-in to another app)

Thanks


It's pretty nearly impossible in principle. If valgrind doesn't know the complete history of all your memory, how can it know for sure that something is a leak, or even a reference to invalid memory?


You can't stop/start instrumentation but you can programmatically do incremental leak checks. See http://valgrind.org/docs/manual/mc-manual.html#mc-manual.clientreqs and specifically VALGRIND_DO_LEAK_CHECK, VALGRIND_DO_ADDED_LEAK_CHECK and VALGRIND_DO_CHANGED_LEAK_CHECK.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜