如何将valgrind用于内存配置文件 [英] How can I use valgrind for memory profile

查看:85
本文介绍了如何将valgrind用于内存配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

能否请您告诉我如何将valgrind用于内存配置文件? 我从Google找到的文章谈到了如何使用valgrind进行内存泄漏.我对如何将其用于内存分析(即哪些类使用了多少内存)感兴趣?

Can you please tell me how can I use valgrind for memory profile? The article I found from google talks about how to use valgrind for memory leak. I am interested in how to use that for memory profiling (i.e. how much memory is used by what classes)?

谢谢.

推荐答案

您可以使用valgrind的 Massif 工具来获取堆配置文件.该代码仍被标记为实验性",并且并非所有版本的valgrind都随附.您可能必须从源代码下载和构建.

You can use valgrind's Massif tool to get a heap profile. This code is still labelled "experimental", and it does not ship with all versions of valgrind. You may have to download and build from source.

还要注意,堆概要文件是由分配站点组织的,这比类要精细.如果您需要按类组织的信息,则必须阅读开发人员文档并获得机器可读的格式,然后找出哪些分配站点与哪些类一起使用-可能需要编译器的支持.

Also note that the heap profile is organized by allocation site, which is a finer granularity than classes. If you need information organized by class, you will have to read the developer documentation and get the machine-readable format, then figure out which allocation sites go with which classes - perhaps with support from your compiler.

即使不支持类,Massif配置文件也可能有用.

Even without support for classes, however, the Massif profile may be useful.

这篇关于如何将valgrind用于内存配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆