How to run Valgrind in parallel with our process so that its performance does not decrease too much?

I need to use Valgrind to detect memory access violations being executed in a server application. The server creates many threads. I suspect that there is a racing condition that causes the server to crash every 1 hour or so. We used Valgrind to analyze memory usage, but server process speed dropped dramatically. The speed of the server has decreased so much that it was hardly useful, and there were no race conditions where possible.

Is there a way to run Valgrind in parallel with our application so that we do not lose such performance?

+5
source share
4 answers

It is worth noting that Valgrind, supporting multithreaded programs, will not actually run program flows in parallel if you have several cores. It also alternates threads with finer grain than its own OS scheduler. These combined 2 facts can make the program behave differently with race conditions or other parallel anomalies.

You might want to try Helgrind , a tool designed primarily for detecting the correct discipline of blocking and drd , a tool designed primarily for detecting data calculations.

+5
source

. Valgrind - . . , - Valgrind.

ulimit, . , , .

+9

, , Valgrind Helgrind?

+1

Valgrind works by connecting to your malloc calls, so you can expect your program to run slower under valgrind. Thus, I would say that you cannot run your program faster under valgrind and take advantage of the analysis of memory errors.

0
source

All Articles