I want to check a long running process for memory leaks with valgrind. I suspect the memory leak I’m after might happen only after several hours of execution. I can run the app under valgrind and get the valgrind log just fine, but doing so means I have to quit the application and start it again anew for a new valgrind session for which I would still have to wait several hours. Is it possible to keep valgrind and the app running and still get valgrind’s (partial) data at any point during execution?
Share
You can do that by using the Valgrind gdbserver and GDB.
In short, you start your program with valgrind as usual, but with the
--vgdb=yesswitch:In another session, you start gdb on the same executable, and connect to valgrind. You can then issue valgrind commands:
See the manual for a list of commands, here for memcheck.