链接时增加了-ltcmalloc,编好之后服务器第一次启动就宕机了,code文件堆栈如下:

Program terminated with signal SIGABRT, Aborted.
# 0x0000000000bdfda8 in raise (sig=sig@entry=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:
../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
# 0x0000000000bdfda8 in raise (sig=sig@entry=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:
# 0x0000000000b63538 in abort () at abort.c:
# 0x0000000000b58487 in uw_init_context_1 (context=context@entry=0x7ffeeca2b170, outer_cfa=outer_cfa@entry=0x7ffeeca2b420, outer_ra=0xaa23da <GetStackTrace_libgcc(void**, int, int)+>)
at ../../../gcc-5.1./libgcc/unwind-dw2.c:
# 0x0000000000b59048 in _Unwind_Backtrace (trace=0xaa25c0 <libgcc_backtrace_helper(_Unwind_Context*, void*)>, trace_argument=0x7ffeeca2b420) at ../../../gcc-5.1./libgcc/unwind.inc:
# 0x0000000000aa23da in GetStackTrace_libgcc (result=<optimized out>, max_depth=<optimized out>, skip_count=<optimized out>) at src/stacktrace_libgcc-inl.h:
# 0x0000000000aa2ab4 in GetStackTrace (result=result@entry=0x2f3d250, max_depth=max_depth@entry=, skip_count=skip_count@entry=) at src/stacktrace.cc:
# 0x0000000000a9f256 in tcmalloc::RecordGrowth (growth=) at src/page_heap.cc:
# tcmalloc::PageHeap::GrowHeap (this=0x1757a80 <tcmalloc::Static::pageheap_>, n=<optimized out>) at src/page_heap.cc:
# 0x0000000000a9f553 in tcmalloc::PageHeap::New (this=0x1757a80 <tcmalloc::Static::pageheap_>, n=n@entry=) at src/page_heap.cc:
# 0x0000000000a99075 in tcmalloc::CentralFreeList::Populate (this=this@entry=0x18dbf00 <tcmalloc::Static::central_cache_+>) at src/central_freelist.cc:
# 0x0000000000a99278 in tcmalloc::CentralFreeList::FetchFromOneSpansSafe (this=0x18dbf00 <tcmalloc::Static::central_cache_+>, N=, start=0x7ffeeca2b5c0, end=0x7ffeeca2b5c8)
at src/central_freelist.cc:
# 0x0000000000a99304 in tcmalloc::CentralFreeList::RemoveRange (this=0x18dbf00 <tcmalloc::Static::central_cache_+>, start=start@entry=0x7ffeeca2b5c0, end=end@entry=0x7ffeeca2b5c8,
N=) at src/central_freelist.cc:
# 0x0000000000aa1110 in tcmalloc::ThreadCache::FetchFromCentralCache (this=this@entry=0x2f7d240, cl=cl@entry=, byte_size=byte_size@entry=,
oom_handler=oom_handler@entry=0xa953d0 <(anonymous namespace)::nop_oom_handler(size_t)>) at src/thread_cache.cc:
# 0x0000000000c2870b in tcmalloc::ThreadCache::Allocate (oom_handler=0xa953d0 <(anonymous namespace)::nop_oom_handler(size_t)>, cl=, size=, this=<optimized out>)
at src/thread_cache.h:
# (anonymous namespace)::do_malloc (size=) at src/tcmalloc.cc:
# tcmalloc::do_allocate_full<tcmalloc::malloc_oom> (size=) at src/tcmalloc.cc:
# tcmalloc::allocate_full_malloc_oom (size=size@entry=) at src/tcmalloc.cc:
# 0x0000000000c28876 in tcmalloc::dispatch_allocate_full<tcmalloc::malloc_oom> (size=) at src/tcmalloc.cc:
# malloc_fast_path<tcmalloc::malloc_oom> (size=size@entry=) at src/tcmalloc.cc:
# tc_malloc (size=size@entry=) at src/tcmalloc.cc:
# 0x0000000000c1cccb in _dl_get_origin () at ../sysdeps/unix/sysv/linux/dl-origin.c:
# 0x0000000000bd58ff in _dl_non_dynamic_init () at dl-support.c:
# 0x0000000000bd6a08 in __libc_init_first (argc=argc@entry=, argv=argv@entry=0x7ffeeca2c7b8, envp=0x7ffeeca2c7e0) at ../csu/init-first.c:
# 0x0000000000b5b23d in __libc_start_main (main=0x41d6dc <main(int, char**)>, argc=, argv=0x7ffeeca2c7b8, init=0xb5b6c0 <__libc_csu_init>, fini=0xb5b750 <__libc_csu_fini>,
rtld_fini=0x0, stack_end=0x7ffeeca2c7a8) at libc-start.c:
# 0x0000000000400c1d in _start ()
(gdb)

因为tcmalloc的静态库文件是自己编译的,有源码,于是乎就开始纠结地看起了源码。看了很久源码并且尝试调试,都没有什么进展。看堆栈提到了_Unwind_Backtrace,并且想起来在编译的时候,看到过关于unwind的相关警告:

$ ./configure
... ...
configure: WARNING: No frame pointers and no libunwind. Using experimental backtrace capturing via libgcc. Expect crashy cpu profiler.

查看源码目录下的INSTALL文件(我的 gperftools 版本是2.7),查看到如下说明:

重新编译:

$ ./configure --enable-frame-pointers
... ...
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/gperftools/tcmalloc.h
config.status: creating src/windows/gperftools/tcmalloc.h
config.status: creating src/config.h
config.status: src/config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
$ make

果然没有警告了,然后拷贝.libs目录下的 libtcmalloc.a 到静态编译目录,重新编译服务器,再次开启,果然没有报错了。

最新文章

  1. 配置DNS服务器,实现局域网内的地址正反向解析
  2. 安卓开发30:AsyncTask的用法
  3. poj 1442 名次树
  4. Excel设置数据有效性实现单元格下拉菜单的3种方法(转)
  5. java第四周学习
  6. 【线段树成段更新成段查询模板】【POJ3468】A Simple Problem with Integerst
  7. NHibernate:教你如何搭建数据访问层?
  8. Linux centos7环境下安装MySQL的步骤详解
  9. 第二阶段第三次spring会议
  10. pb数据窗口之间的传参
  11. Python/spss-多元回归建模-共线性诊断1(推荐A)
  12. Oracle EBS 获取说明性弹性域全局数据元
  13. VRSProcess(一)
  14. centos7下的防火墙
  15. C# 根据twitter的snowflake算法生成唯一ID
  16. 编写高质量代码改善C#程序的157个建议——建议146:只对外公布必要的操作
  17. cygwin下编译zlib源代码
  18. 第十二篇 os模块
  19. 关于dataTable 生成JSON 树
  20. web安全测试---跨站点脚本测试

热门文章

  1. Balanced Substring
  2. fpga rom 初始化mif文件生成
  3. LG3835 【模板】可持久化平衡树
  4. bzoj1426(洛谷4550)收集邮票
  5. 谈谈JS中的高级函数
  6. RK3288 OTG切换为Host模式
  7. 修改配置文件matplotlibrc,让Matplotlib显示中文
  8. 免费数据集下载网站【dataset】
  9. 关于如何利用Pocket CHM Pro制作帮助文档
  10. 队列之blah集合