0

Using valgrind in the context of a C++ project, I have been trying to suppress memory leak information coming from third party libraries. I would generate the specific suppression file entry running valgrind with --gen-suppressions=all and obtain for example:

{
   <insert_a_suppression_name_here>
   Memcheck:Leak
   match-leak-kinds: reachable
   fun:malloc
   obj:/usr/lib/x86_64-linux-gnu/libcuda.so.515.105.01
   obj:/usr/lib/x86_64-linux-gnu/libcuda.so.515.105.01
   obj:/usr/lib/x86_64-linux-gnu/libcuda.so.515.105.01
   obj:/usr/lib/x86_64-linux-gnu/libcuda.so.515.105.01
   obj:/usr/lib/x86_64-linux-gnu/libcuda.so.515.105.01
   obj:/usr/lib/x86_64-linux-gnu/libcuda.so.515.105.01
   obj:/usr/lib/x86_64-linux-gnu/libcuda.so.515.105.01
   obj:/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudart.so.11.6.55
   obj:/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudart.so.11.6.55
   obj:/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudart.so.11.6.55
   obj:/usr/local/cuda-11.6/targets/x86_64-linux/lib/libcudart.so.11.6.55
}

Now I would like to generalize that rule so that it suppresses any warning coming from any library called *libcuda*. I tried different things, like:

{
   cuda
   memcheck:Leak
   ...
   obj:*libcuda*
   ...
}

or

{
   cuda
   memcheck:Leak
   obj:*libcuda*
}

or (inspired by this)

{
   cuda
   memcheck:Leak
   fun:*alloc
   ...
   obj:*libcuda*
   ...
}

None of this worked, so even if the suppression file is read by valgrind with no complaint, none of my libcuda originated messages get suppressed. Is there a way to make Valgrind accept this kind of generic suppression commands?

Antonio
  • 19,451
  • 13
  • 99
  • 197

1 Answers1

2

The main problem is that you have mispelled Memcheck with lowercase m.

The following will work:

{
   cuda
   Memcheck:Leak
   ...
   obj:*libcuda*
}

The last frame wildcard ... you had put is not necessary.

Antonio
  • 19,451
  • 13
  • 99
  • 197
deribaucourt
  • 424
  • 8