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

280 Views Asked by At

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).

2

There are 2 best solutions below

2
On BEST ANSWER

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.

1
On

If you can, adjust your initial program so that you can turn the thread-spawning off with a command-line argument. Run valgrind on the result, with the thread-spawning removed.