开发者

How can I use valgrind for memory profile

开发者 https://www.devze.com 2022-12-23 16:05 出处:网络
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 memo开发者_Go百

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 memo开发者_Go百科ry profiling (i.e. how much memory is used by what classes)?

Thank you.


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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号