终止bad_alloc异常,但堆栈跟踪中没有"new"
Terminate with bad_alloc exception, but no "new" in stack trace
c++程序抛出这个:
抛出'St9bad_alloc'实例后终止调用what(): std::bad_alloc
似乎是从new抛出的,但是堆栈跟踪没有显示对new的任何调用:
#0 0x0000003174a330c5 in raise () from /lib64/libc.so.6
#1 0x0000003174a34a76 in abort () from /lib64/libc.so.6
#2 0x00007f93b1b7b0b4 in __gnu_cxx::__verbose_terminate_handler ()
at ../../../../gcc-4.3.4/libstdc++-v3/libsupc++/vterminate.cc:98
#3 0x00007f93b1b794f6 in __cxxabiv1::__terminate (handler=0x522b)
at ../../../../gcc-4.3.4/libstdc++-v3/libsupc++/eh_terminate.cc:43
#4 0x00007f93b1b79523 in std::terminate ()
at ../../../../gcc-4.3.4/libstdc++-v3/libsupc++/eh_terminate.cc:53
#5 0x00007f93b1b79536 in __cxxabiv1::__unexpected (handler=0x522b)
at ../../../../gcc-4.3.4/libstdc++-v3/libsupc++/eh_terminate.cc:59
#6 0x00007f93b1b78ec8 in __cxxabiv1::__cxa_call_unexpected (exc_obj_in=0x7f93b1dae770)
at ../../../../gcc-4.3.4/libstdc++-v3/libsupc++/eh_personality.cc:750
#7 0x00007f93b2c356e0 in network::HttpLoader::doLoad (this=0x7f938801ef20) at loaders/HttpLoader.cxx:1071
#8 0x00007f93b2c70971 in network::Loader::load (this=0x522b) at Loader.cxx:899
#9 0x00007f93b2c74a15 in network::Loader::load2 (this=0x522b) at Loader.cxx:925
#10 0x00007f93b2c7b13a in network::LoaderThread::run() ()
#11 0x00007f93b1e60be4 in threads::Thread_startWorker (thr=0x7f938801e460) at Threads.cxx:479
#12 0x00007f93b1e60ead in threads::ThreadPool::run (this=0x1140478, thr=0x7f938801eeb0) at Threads.cxx:727
#13 0x00007f93b1e608e8 in threads::__Thread_startWorker (param=<value optimized out>) at Threads.cxx:520
#14 0x0000003175206ccb in start_thread () from /lib64/libpthread.so.0
#15 0x0000003174ae0c2d in clone () from /lib64/libc.so.6
在dolad()开头添加了调试语句,但它永远不会到达那个点。
难住了!
任何想法吗?
new
调用可能不在堆栈中,因为它在应用程序终止时已经展开。我尝试在抛出异常的那一刻设置一个断点(例如,在gdb下使用catch throw
)——此时您将在堆栈中看到异常的原因
可能由于优化而内联了new
调用。尝试禁用优化,至少在loaders/HttpLoader.cxx
中。
相关文章:
- 如果"new int"返回"int*",那么为什么"new int[n]"不返回"int**"?
- 光线跟踪器灯光反射错误
- 有没有一种方法可以使用placement new将堆叠对象分配给分配的内存
- 重载运算符new[]的行为取决于析构函数
- 人脸跟踪arduino代码的优化
- 跟踪滚动条上的鼠标事件
- 过载'operator new'如何导致无限循环?
- 创建具有 new in 函数和"this is nullptr"异常的对象
- Codelite C++ new project
- 在类c++中使用new声明数组
- g++用户定义的动态链接库上的全局new和delete运算符
- 如何使用新运算符跟踪在循环中创建的 QLabel
- 如果整个应用程序是虚拟映射的,为什么 new 会进行系统调用?
- 在将 new 与指针一起使用时,创建数组的指定长度
- C++:跟踪类对象
- 用于解析 win64 堆栈跟踪的命令行客户端(可以访问符号服务器)
- 跟踪日志中的T.11803()是什么意思?
- 使用重载的 new 和 delete 运算符跟踪已用内存
- 如何重载操作符new和delete来跟踪内存
- 终止bad_alloc异常,但堆栈跟踪中没有"new"