Why is Valgrind stating that my implementation of std::map produces a memory leak?

前端 未结 2 1579
既然无缘
既然无缘 2021-01-14 14:14

Valgrind is outputting the following:

==14446== 2,976 (176 direct, 2,800 indirect) bytes in 2 blocks are definitely lost in loss record 23 of 33
==14446==            


        
2条回答
  •  不思量自难忘°
    2021-01-14 14:50

    The error does not seem to come from your code, but a library you are using.

    Valgrind comes with some default error suppression, but that probably does not cover the library you are using.

    The error-checking tools detect numerous problems in the base libraries, such as the GNU C library, and the X11 client libraries, which come pre-installed on your GNU/Linux system. You can't easily fix these, but you don't want to see these errors (and yes, there are many!) So Valgrind reads a list of errors to suppress at startup. A default suppression file is created by the ./configure script when the system is built.

    You can create your own error suppressions that you know are irrelevant to your code.

    See the similar SO question Why does Valgrind not like my usage of glutCreateWindow?

提交回复
热议问题