简体   繁体   中英

Chances of memory leak when valgrind says no memory leak

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM