Reputation: 63
C++ program is throwing this:
terminate called after throwing an instance of 'St9bad_alloc' what(): std::bad_alloc
Which it appears to be thrown from new, but the stack trace doesn't show any calls to 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
Added debugging statements at the beginning of doLoad(), but it never gets to that point.
Stumped!
Any thoughts?
Upvotes: 0
Views: 1524
Reputation: 35775
Maby the new
call was inlined due to optimizations. Try to disable optimizations, at least in loaders/HttpLoader.cxx
.
Upvotes: 0
Reputation: 35935
The new
call may not be in the stack because it has already unwound at the point your application is terminating. I'd try to set a breakpoint at the moment the exception is thrown (e.g., using catch throw
under gdb) -- at that point you'll see the cause of the exception in the stack.
Upvotes: 3