linux - 运行 Valgrind 会减慢我的应用程序的速度吗?

标签 linux memory valgrind

我只是想跟踪各个进程正在使用多少内存(不同的选项可以从根本上改变这个特定应用程序的内存使用情况)。我不喜欢其他地方描述的各种“查找进程 pid 和 grok/proc/pid/smaps”解决方案...

是否有替代命令可以仅转储特定进程的内存使用情况?内存?

最佳答案

根据Valgrind Manual ,Valgrind 会非常明显地减慢你的应用程序:

The amount of instrumentation code added varies widely between tools. At one end of the scale, Memcheck adds code to check every memory access and every value computed, making it run 10-50 times slower than natively. At the other end of the spectrum, the minimal tool, called Nulgrind, adds no instrumentation at all and causes in total "only" about a 4 times slowdown.

根据我的经验,Valgrind 确实将应用程序的速度减慢了大约 10 倍。

您需要报告多详细的内存使用情况? top(RES 列)还不够吗?

关于linux - 运行 Valgrind 会减慢我的应用程序的速度吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29365611/

相关文章:

c - 无法解决客户端-服务器程序上大小为 1 的无效读取

c - obj-y += something/in linux kernel Makefile 是什么意思?

linux - 没有可用的 boost 线程?

linux - 将手册页指向不同的位置

python - 列表推导式和一行 for 循环

c# - 统一: What's allocating memory in my function?

c - 应该将任何 C 文件作为二进制文件打开

c - 在 Solaris/Linux 中释放分配的内存

C Valgrind 堆栈跟踪失败,线性 malloc 结构数组

c - 为结构数组分配空间,Valgrind 无效读取