开发者

valgrind on server process

开发者 https://www.devze.com 2022-12-24 18:15 出处:网络
hi i am new to valgrind. I know how to run valgrind on executable files from command line. But how do you run valgrind on server processes like apa开发者_运维百科che/myqld/traffic server etc ..

hi i am new to valgrind. I know how to run valgrind on executable files from command line. But how do you run valgrind on server processes like apa开发者_运维百科che/myqld/traffic server etc ..

I want to run valgrind on traffic server (http://incubator.apache.org/projects/trafficserver.html) to detect some memory leaks taking place in the plugin I have written.

Any suggestions ?

thanks, pigol


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号