valgrind - Find memory leak in a shared library

前端 未结 2 1790
無奈伤痛
無奈伤痛 2021-02-19 23:43

I need to know ways to find out the memory leaks in a shared library which will be loaded to a release binary. I mean shared library I built with -g option but the binary that l

2条回答
  •  长发绾君心
    2021-02-20 00:25

    As the previous answer suggests, this is because you have closed your libraries before the program terminates and therefore symbol information is not available to valgrind.

    Using LD_PRELOAD didn't work for me; I now have two builds; one that explicitly does not call dlclose(); on this build, valgrind correctly reports line number information as you would expect with dynamic linking.

提交回复
热议问题