0
  1. 安装 jemalloc
  • ./configure --enable-prof --enable-stats --enable-debug --enable-fill --enable-prof-gcc --disable-prof-libunwind --enable-static
  • make & make install
  1. 编写如下代码:
#include<stdio.h>
int main(){
   printf("exec finish\n");
}
  1. 编译代码和静态链接jemalloc:
    gcc example.cpp -ljemalloc -L'/usr/local/lib' -I'/usr/local/include/' -lm -ldl -lpthread -static

  2. export MALLOC_CONF='prof:true'

  3. 运行 bin: ./a.out ==> 它将是具有分段错误的核心。

gdb核心函数栈如下:
在此处输入图像描述

4

0 回答 0