You have to start the server under Valgrind s control. Simply take the server s normal start command, and prepend it with valgrind
.
Valgrind will attach to every process your main "server" process spawns. When each thread or process ends, Valgrind will output its analysis, so I d recommend piping that to a file (not sure if it comes out on stderr or stdout.)
If your usual start command is /usr/local/mysql/bin/mysqld
, start the server instead with valgrind /usr/local/mysql/bin/mysqld
.
If you usually start the service with a script (like /etc/init.d/mysql start
) you ll probably need to look inside the script for the actual command the script executes, and run that instead of the script.
Don t forget to pass the --leak-check=full
option to valgrind to get the memory leak report.