C++ 无序映射产生以下 gdb 输出的可能原因是什么?

What are possible causes for a C++ unordered map to produce the following gdb output?

我在 C++11 中使用无序映射,这些映射的键是各种数字和字符的串联字符串。我使用的密钥示例是:

coeff_key = "_"+to_string(first_k_index) +"_"+ to_string(second_k_index) +"_"+ to_string(i) +"_"+ to_string(j)+"_";

我可以填满所有的地图,但是一旦我尝试访问某个键,就会出现问题。此外,如果 first_k_index 的值可以是 0-3,则不会出现错误。但是如果first_k_index的值可以是0-9,代码就不会运行完全。这是 gdb 的输出。

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

Program received signal SIGABRT, Aborted.
0x00002aaab1d2a387 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.17-307.el7.1.x86_64 libgcc-4.8.5-39.el7.x86_64 libstdc++-4.8.5-39.el7.x86_64
(gdb) where
#0  0x00002aaab1d2a387 in raise () from /lib64/libc.so.6
#1  0x00002aaab1d2ba78 in abort () from /lib64/libc.so.6
#2  0x00002aaab15357d5 in __gnu_cxx::__verbose_terminate_handler() () from /lib64/libstdc++.so.6
#3  0x00002aaab1533746 in ?? () from /lib64/libstdc++.so.6
#4  0x00002aaab1533773 in std::terminate() () from /lib64/libstdc++.so.6
#5  0x00002aaab1533993 in __cxa_throw () from /lib64/libstdc++.so.6
#6  0x00002aaab1533f2d in operator new(unsigned long) () from /lib64/libstdc++.so.6
#7  0x00002aaab1533fc9 in operator new[](unsigned long) () from /lib64/libstdc++.so.6
#8  0x00000000004035b6 in main ()

有多种可能的原因,最有可能的是没有足够的内存来构建地图。 另见:Debugging strategy to find the cause of bad_alloc

Docs