简体   繁体   English

使用gperftools的堆分析器来分析libc malloc

[英]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 所以你可以

  • wait for Google developers to remove this requirement (this may be a wait of a few days, or a few years -- I have no idea. Actually, it looks like above github.io page hasn't been updated since 2012, so I wouldn't hold my breath here), or 等待Google开发人员删除此要求(可能要花几天或几年的时间-我不知道。实际上,上面的github.io页面看起来自2012年以来就没有更新过,所以我不会在这里屏住呼吸),或者
  • contribute the code required for separation yourself, or 贡献自己分离所需的代码,或者
  • find an equivalent way to do this with GLIBC (and possibly contribute that code to GLIBC). 找到一种等效的方式来使用GLIBC(并可能将该代码贡献给GLIBC)。

I am not aware of any existing GLIBC equivalents that work today. 我不知道今天有任何现有的GLIBC等效产品。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 gperftools 有条件地分析 C++ 代码? - How to use gperftools to conditionally profile C++ code? cmake:无法链接到Google Profiler(gperftools) - cmake : failing to link against google profiler (gperftools) 如何正确处理信号,以便gperftools CPU Profiler仍然有效? - How to properly handle signals, so that gperftools CPU profiler still works? 我使用gperftools使用RCpp解析R脚本正确吗? - Is my using gperftools to profile a R script with RCpp correct? 我已经设置了CPUPROFILE环境变量并链接了-lprofiler。 为什么gperftools无法启动分析器? - I've set the CPUPROFILE environment variable and linked -lprofiler. Why is gperftools not starting the profiler? C ++ malloc.c:2905:__libc_malloc:断言 - C++ malloc.c:2905: __libc_malloc: Assertion 检测到堆损坏 Malloc() Free() - Heap Corruption Detected Malloc() Free() 我已经安装了gperftools-2.0,但是我无法获取CPU配置文件统计信息 - i have installed gperftools-2.0, but i can't get cpu profile statistics 为什么符号malloc,__ malloc和__libc_malloc指向相同的代码地址? - Why symbols malloc, __malloc and __libc_malloc point to the same code address? malloc如何分配内存以及Heap的大小是多少? - How malloc allocates memory and what is the size of Heap?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM