Search code examples
c++multithreadingvalgrindmemcheck

How can I prevent Valgrind from starting embedded gdbservers for every new thread?


I'm running valgrind memcheck on a program that spawns thousands of other threads.

The other threads do not generate errors, and I don't care what happens to them.

However, Valgrind insists on opening a named pipe in /tmp every time a new thread spawns. Not only is this wasteful, it actually breaks valgrind. Sometimes valgrind doesn't clean up after itself, and then future children with the same pid (active at a later time) fail to spawn because valgrind can't make a pipe with the right name (it already exists).

How can I prevent Valgrind from making all these pipes!?!

EDIT: Flags I have already tried:

--child-silent-after-fork=yes

and things I have already ruled out:

--track-children=no (default value is no).


Solution

  • Sorry to answer my own question. Just for documentation purposes.

    Running with the flag:

    --vgdb=no
    

    This is not properly documented in the man pages, since it doesn't tell you that it's going to spew pipes everywhere without the flag, but that's why it does it.