开发者

Chances of memory leak when valgrind says no memory leak

开发者 https://www.devze.com 2023-04-08 00:08 出处:网络
My Ccode does not show any memory leak while checking with valgrind. But when i integrate that code with another system, which has its own memory management but of course callsmallocfor allocating mem

My C code does not show any memory leak while checking with valgrind. But when i integrate that code with another system, which has its own memory management but of course calls malloc for allocating memory, shows memory leak. Valgrind check used to be correct everytime, but this time its not working for me. I would like to know if there is chances of memory leak although valgrind says no memory leak. What can be the strongest parameters of valgrind to开发者_开发问答 set to find the hardest memory leak?


I think it's very possible that you still have a memory leak - not because I think that valgrind has bugs, but because I think that integrating it with another project probably exercises the code differently than your test does. (FYI - I haven't found any cases of memory leaks where valgrind says my code is clear, although that's hardly exhaustive proof). I think in order to solve the problem is to either add tests to your un-integrated version or to run the integrated version in valgrind.

Other options might be making sure you're not suppressing any errors that could be harmful, add --leak-check=full, or otherwise play with your valgrind setup.

0

精彩评论

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

关注公众号