英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论