c++ - std::bad_alloc when inserting into std::unordered_map? -
    i'm getting std::bad_alloc following code:   typedef std::unordered_map<chash, block_extended_info> map_type; map_type m_foo;   // transgressor: auto r = m_foo.insert(map_type::value_type(id, bei));   it happens of time while running test cases use method containing line, , other times doesn't.  had changed code use m_foo[id] = bei , caused stop happening 1 compilation, when recompiled again failed, changed above, continued fail.  issue deeper that.   i sure it's not matter of running out of memory since have top  running while test cases running , doesn't anywhere near filling memory.   what may causing std::bad_alloc?  in details of chash  , block_extended_info  may causing this?  objects of types copied , passed around on place in other parts of code , doesn't cause issues.   here's definition of chash :   class chash {   char data[32]; };   and following required define block_extended_info :   class csignature {   chash c, r; }; enum foob { /* ... ...