可以使用Valgrind来分析我的程序中哪些函数使用了最多的内存吗?

huangapple go评论62阅读模式
英文:

Can I use Valgrind to analyze which functions in my program are using the most memory?

问题

我已经获得了一个可执行文件,我需要分析它的内存使用情况 - 具体来说是哪些函数在使用最多的内存。

我已经使用Valgrind来执行内存泄漏检查和分析堆上在特定时间使用了多少内存等等。但是,我不确定如何使用它来分析内存使用情况按函数划分。我知道Callgrind允许我看到哪些函数被调用最多。是否有办法使用Callgrind(或其他Valgrind工具)来查看哪些函数使用了最多的内存?

英文:

I have been given an executable where I have to analyze its memory usage - specifically which functions are using the most memory.

I have used Valgrind to perform memory leak checks and analyzing how much of the heap is used at a given time, etc. However, I am not sure how to use it to analyze memory by function. I know Callgrind allows me to see which functions are called the most. Is there any way to usee Callgrind (or other Valgrind tools) to see which functions are using the most memory?

答案1

得分: 1

尝试使用massif(如果您可以安装它的话),Valgrind工具对这项工作来说有点过于粗重,我还建议查看heaptrack。

https://github.com/KDE/heaptrack

英文:

Try massif (and massif-visualizer if you can install it).

Valgrind tools are a bit of a sledgehammer for this job, and I would also recommend looking at heaptrack.

https://github.com/KDE/heaptrack

huangapple
  • 本文由 发表于 2023年6月8日 11:59:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/76428529.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定