服务器进程上的 valgrind
嗨,我是 valgrind 的新手。我知道如何从命令行对可执行文件运行 valgrind。但是如何在 apache/myqld/traffic 服务器等服务器进程上运行 valgrind ..
我想在流量服务器上运行 valgrind (http://incubator.apache.org/projects/trafficserver.html)来检测我编写的插件中发生的一些内存泄漏。
有什么建议吗?
谢谢, 皮戈尔
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 apache/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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须在 Valgrind 的控制下启动服务器。只需采用服务器的正常启动命令,并在其前面加上 valgrind 即可。
Valgrind 将附加到您的主“服务器”进程产生的每个进程。当每个线程或进程结束时,Valgrind 将输出其分析,因此我建议将其传输到一个文件(不确定它是否出现在 stderr 或 stdout 上。)
如果您常用的启动命令是
/usr/local/ mysql/bin/mysqld
,使用 valgrind /usr/local/mysql/bin/mysqld 启动服务器。如果您通常使用脚本启动服务(例如
/etc/init.d/mysql start
),您可能需要在脚本内部查找脚本执行的实际命令,然后运行它脚本的。不要忘记将
--leak-check=full
选项传递给 valgrind 以获取内存泄漏报告。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 withvalgrind /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.