0

I have several tests that run and in the end I run Valgrind to verify my libraries memory usage. Valgrind consistently complains about:

==27022== HEAP SUMMARY:
==27022==     in use at exit: 6,139 bytes in 3 blocks
==27022==   total heap usage: 609 allocs, 606 frees, 19,877,073 bytes allocated
==27022== 
==27022== 32 bytes in 1 blocks are still reachable in loss record 1 of 3
==27022==    at 0x4A08121: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==27022==    by 0x3A1A60168F: _dlerror_run (in /usr/lib64/libdl-2.17.so)
==27022==    by 0x3A1A601197: dlsym (in /usr/lib64/libdl-2.17.so)
==27022==    by 0x3A9D8A796D: ??? (in /usr/lib64/nvidia/libGL.so.331.67)
==27022==    by 0x3A9DAE965F: ??? (in /usr/lib64/nvidia/libGL.so.331.67)
==27022==    by 0x3A9DB1CB1F: ???
==27022==    by 0x3A9D8CD36A: ??? (in /usr/lib64/nvidia/libGL.so.331.67)
==27022== 
==27022== 83 bytes in 1 blocks are still reachable in loss record 2 of 3
==27022==    at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==27022==    by 0x3A1A2863F9: strdup (in /usr/lib64/libc-2.17.so)
==27022==    by 0x3A9D8A964E: ??? (in /usr/lib64/nvidia/libGL.so.331.67)
==27022==    by 0x6578652F32322F: ???
==27022== 
==27022== 6,024 bytes in 1 blocks are definitely lost in loss record 3 of 3
==27022==    at 0x4A08121: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==27022==    by 0x3A9D8C032E: ??? (in /usr/lib64/nvidia/libGL.so.331.67)
==27022== 
==27022== LEAK SUMMARY:
==27022==    definitely lost: 6,024 bytes in 1 blocks
==27022==    indirectly lost: 0 bytes in 0 blocks
==27022==      possibly lost: 0 bytes in 0 blocks
==27022==    still reachable: 115 bytes in 2 blocks
==27022==         suppressed: 0 bytes in 0 blocks

These do not seem to be related to my library. Should I be concerned about theses warnings? Or should I be making an attempt to suppress these leaks? If I should suppress what would be the cleanest way to do this from a Makefile?

jww
  • 97,681
  • 90
  • 411
  • 885
Matthew Hoggan
  • 7,402
  • 16
  • 75
  • 140

1 Answers1

1

It is hard to say whether you should suppress them or not, but if you are certain that your library is clean, you can generate a suppression file.

You can then call Valgrind with the "--suppressions" flag. If the name of your suppression file is suppfile:

> valgrind --suppressions=suppfile ./program

If you are executing valgrind from a Makefile, add the suppressions flag to the valgrind command. You can also create a default options file ".valgrindrc", which you put in the same directory as your Makefile. In this file, put any arguments you want.

K-J
  • 548
  • 2
  • 16