[英]Use gperftools' heap profiler to profile libc malloc
I am trying to profile an application to compare its performance using different allocation strategies. 我正在尝试分析应用程序,以使用不同的分配策略比较其性能。
I have no trouble profiling it when using tcmalloc but how to profile it using libc's allocation functions ? 使用tcmalloc进行配置时,我没有任何问题,但是如何使用libc的分配函数进行配置? Indeed, enabling gperftool's heap profiler requires to use
-ltcmalloc
flag ¹ but this results as tcmalloc being used as allocation strategy. 确实,启用gperftool的堆分析器需要使用
-ltcmalloc
标志¹,但这导致将tcmalloc用作分配策略。
how to profile it using libc's allocation functions?
如何使用libc的分配功能对其进行概要分析?
Note: this requirement is a bit strange: it's not like your application will suddenly start using more or less heap memory, or change its allocation pattern or sites when you switch from tcmalloc to GLIBC malloc. 注意:此要求有点奇怪:当您从tcmalloc切换到GLIBC malloc时,您的应用程序不会突然开始使用或多或少的堆内存,或者更改其分配模式或站点。
From https://gperftools.github.io/gperftools/heapprofile.html : 来自https://gperftools.github.io/gperftools/heapprofile.html :
Heap profiling requires the use of libtcmalloc.
堆分析需要使用libtcmalloc。 This requirement may be removed in a future version of the heap profiler, and the heap profiler separated out into its own library.
可以在以后版本的堆探查器中删除此要求,并将堆探查器分离到其自己的库中。
So you can 所以你可以
I am not aware of any existing GLIBC equivalents that work today. 我不知道今天有任何现有的GLIBC等效产品。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.