The bug disturbed me about two days: when running the code I have a runtime error of \"terminate called without an active exception\\n Aborted\",why?
I try to locate the
The "terminate without an active exception" message is a hint that, at some point in your program, exception handling got broken.
The memory allocation is probably the primary cause, but probably not the error site. The large allocation will throw a std::bad_alloc exception, and this exception is incorrectly handled somewhere.
To validate the theory, insert a line like
throw std::logic_error("Foo");
above the allocation, this should trigger the bug as well.
I've encountered two common causes for this:
You should be able to diagnose the latter condition with a debugger. A stack trace of your application (e.g. obtained by running it in gdb) should help greatly.