When a memory error is encountered, execution will pause and live debugging can be performed using GDB.
valgrind --vgdb-error=0 redis-server /path/to/redis.conf
Generate call graphs that can be visualized to detect program bottlenecks. (I use KCacheGrind for visualization.)
valgrind --tool=callgrind redis-server /path/to/redis.conf
Generate heap profiles that can be visualized to track heap memory consumption.
valgrind --tool=massif redis-server /path/to/redis.conf
Attempt to track log race conditions encountered during execution.
(Note - generates a lot of false positives)
The sample here is a script like server_tee.sh
that logs output and prints to stdout.
valgrind --tool=helgrind --free-is-write=yes --ignore-thread-creation=yes --check-stack-refs=no redis-server /path/to/redis.conf 2> >(tee $1)