问题描述
我正在尝试运行google-perf工具来查找我的代码(堆分析器)中的泄漏。 我已经安装:
- libgoogle-perftools-dev
- automake
- autoconf
- libtool
- tcmalloc
我用于测试堆分析器的简单代码:
#include <iostream>
#include <unistd.h>
int main()
{
while(true){
int* p = new int[1000];
std::cout << "wake" << std::endl;
sleep(3);
}
return 0;
}
g++ -std=c++17 -ltcmalloc main.cpp -o MyProg
现在,我想使用堆分析器运行程序:
HEAPPROFILE=/test_profiler_output/res MyProg
但是我得到的是:
MyProg: command not found
如何使用heapprofiler运行程序并获取内存使用情况图?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)