You must start the server under the control of Valgrind. Just take the command to start the server normally and add it using valgrind .
Valgrind will be attached to each process that is launched by your main "server" process. When each thread or process ends, Valgrind will output its analysis, so I would recommend passing it to a file (not sure if it goes to stderr or stdout.)
If your usual run command is /usr/local/mysql/bin/mysqld , instead run the server valgrind /usr/local/mysql/bin/mysqld .
If you usually start the service with a script (e.g. /etc/init.d/mysql start ), you probably have to look inside the script for the actual command that the script is executing and run it instead of the script.
Remember to pass the --leak-check=full parameter to valgrind to get a memory leak report.
Andy shellam
source share