本文介绍了tcmalloc不生成堆栈跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行与tcmalloc链接的二进制文件,并且没有生成堆栈跟踪它正在检测泄漏.

I am running a binary linked with tcmalloc and it is not generating a stack tracefor leaks it is detecting.

The output says:
The 1 largest leaks:
Leak of 1401231 bytes in 82093 objects allocated from:


If the preceding stack traces are not enough to find the leaks, try running THIS shell command:

pprof ../../prog "/tmp/prog.15062.prog-end.heap" --inuse_objects --lines --heapcheck  --edgefraction=1e-10 --nodefraction=1e-10 --gv

当我运行pprof时,我收到一条消息,提示没有要打印的节点.

When I run pprof I get a message that there are no nodes to print.

我附上了可能有内存泄漏的代码

I am enclosing code which has the suspected memory leak by

HeapLeakChecker checker("prog");
....
assert(checker.NoLeaks());

关于如何调试它的任何想法?

Any ideas as to how to debug this?

推荐答案

我建议尝试使用-fno-omit-frame-pointer(gcc)构建程序,因为可能需要使用帧指针来获取堆栈跟踪一些设置.

I would suggest trying to build the program with -fno-omit-frame-pointer (gcc), as frame pointers might be needed to get a stack trace in some setups.

tcmalloc通常使用libunwind来获取堆栈跟踪,但是由于死锁问题,这种方法并非在所有地方都可用.

tcmalloc usually uses libunwind to get the stack traces, but because of deadlock issues this is not usable everywhere.

一个有趣的信息是,如果生成的文件(在本例中为/tmp/prog.15062.prog-end.heap)包含一些地址.

An interesting information would be if the generated file (/tmp/prog.15062.prog-end.heap in this case) contains some adresses.

这篇关于tcmalloc不生成堆栈跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 05:27