Valgrind errors when linked with -static — Why?

后端 未结 2 902
被撕碎了的回忆
被撕碎了的回忆 2020-12-06 17:24

I have a test driver linked to a library I wrote. The library uses autotools so it produces both an archive (.a file) and a dynamic library (.so).

When I link my dri

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-06 18:15

    If the library causes problems in valgrind, you can only ignore those problems by writing suppression files.

    One of problems I encountered is alocating something on the heap, like this :

    // library
    int * some = new int;
    
    // main links the library
    int main()
    {
    }
    

    This example would report an error about leak.

    EDIT : if you have the library's source, you can fix the error (use of uninitialized variable), and recompile it.

提交回复
热议问题