title: unordered_map segment fault
body: <p>I am trying to complete an intepreter using c++. The raw version works well. I try to add a memory pool and gc to it. The memory pool class MemPool contains a pointer to MemList, and MemList contains pointers to freelist and busylist. They are pointers to MemBlock, MemBlock contains a void * pointer for allocate block.</p>
  
  <p>I override operator new and delete for syntaxtree node. Operator new is only used for ASTree base class and malloc is used as an alternative at other cases. ASTree is base class for all syntax tree node.</p>
  
  <pre><code>void *ASTree::operator new(size_t size){
      cout&lt;&lt;"Using modified new operator!"&lt;&lt;endl;
      void *buff=MemPool::getInstance()-&gt;alloc(size);
      return buff;
  }
  
  void ASTree::operator delete(void *buff){
      if(!MemPool::getInstance()-&gt;dealloc(buff))
          throw MemoryError(curmodname,curline);
  }
  </code></pre>
  
  <p>In declaration node, I use unordered_map to store related sub declarations.</p>
  
  <pre><code>class DeclModule:public Declaration{
  public:
      DeclModule(const string &amp;modname);
  //    ~DeclModule();
      int getDeclType();
      void intepret();
      string modname;
  
      unordered_map&lt;string, DeclModule *&gt; modulelist;
      unordered_map&lt;string, DeclClass *&gt; classlist;
      unordered_map&lt;string, DeclMethod *&gt; methodlist;
      DeclEntry *entry;
  };
  </code></pre>
  
  <p>I find the program crashes in different places at different time. I find the error may be caused by unordered_map</p>
  
  <pre><code>DeclMethod *declmethod=methodParser();
  declmodule-&gt;methodlist[declmethod-&gt;methodname]=declmethod;
  </code></pre>
  
  <p>sometimes xcode locates the error in            __nd = __bucket_list_[__chash];</p>
  
  <pre><code>template &lt;class _Key, class _Args&gt;
  _LIBCPP_INLINE_VISIBILITY
  pair&lt;typename __hash_table&lt;_Tp, _Hash, _Equal, _Alloc&gt;::iterator, bool&gt;
  __hash_table&lt;_Tp, _Hash, _Equal, _Alloc&gt;::__emplace_unique_key_args(_Key const&amp; __k, _Args&amp; __args)
  #endif
  {
  
      size_t __hash = hash_function()(__k);
      size_type __bc = bucket_count();
      bool __inserted = false;
      __next_pointer __nd;
      size_t __chash;
      if (__bc != 0)
      {
          __chash = __constrain_hash(__hash, __bc);
          __nd = __bucket_list_[__chash];
          if (__nd != nullptr)
          {
              for (__nd = __nd-&gt;__next_; __nd != nullptr &amp;&amp;
                                         __constrain_hash(__nd-&gt;__hash(), __bc) == __chash;
                                                             __nd = __nd-&gt;__next_)
              {
                  if (key_eq()(__nd-&gt;__upcast()-&gt;__value_, __k))
                      goto __done;
              }
          }
      }
  </code></pre>
  
  <p>Sometimes error is located</p>
  
  <pre><code>__builtin_operator_delete(__ptr);
  </code></pre>
  
  <p>Sometimes xcode tells me I cannot used freed (pointer or memory? cannot remember clearly). I am sure error happens at the time unodered_map insert is called. I guess when I insert a element ,new and delete are called. may </p>
  
  <p>Need your help T-T,could you tell me where wrong is and how to modify it</p>