Allocator exception whilst using boost unordered map
<p>My program processes messages containing updates. Each message can have multiple updates.
I am using boost unordered map to store the update identifer and correspoding object on which the processing is to be done.</p>

<p>I do something like this.</p>

<pre><code>unorderedUpdateMap[updateID] = processObject;
</code></pre>

<p>Normally the program works fine. But during heavy load situations (when there are lot of updates) the list probably grows to a large value and the process crashes with following  core dump.</p>

<pre><code> (gdb) bt
#0  0x00007fcbf562b678 in (anonymous namespace)::cpp_alloc(unsigned long, bool) () from /opt/gts/3pp/usr/lib64/libtcmalloc_minimal.so.0
#1  0x00007fcbf5635218 in tc_new () from /opt/gts/3pp/usr/lib64/libtcmalloc_minimal.so.0
#2  0x00007fcbeb7bee14 in __gnu_cxx::new_allocator&lt;boost::unordered_detail::hash_node&lt;std::allocator&lt;std::pair&lt;long const, mds::InstrumentData*&gt; &gt;, boost::unordered_detail::ungrouped&gt; &gt;::allocate
    (this=0x472d3b0, __n=1) at /usr/lib/gcc/x86_64-redhat-linux6E/4.4.0/../../../../include/c++/4.4.0/ext/new_allocator.h:89
#3  0x00007fcbeb7bd191 in boost::unordered_detail::hash_node_constructor&lt;std::allocator&lt;std::pair&lt;long const, mds::InstrumentData*&gt; &gt;, boost::unordered_detail::ungrouped&gt;::construct_preamble (
    this=0x53c67f90)
    at /usr/include/boost/unordered/detail/util.hpp:319
#4  0x00007fcbeb7bb2d9 in boost::unordered_detail::hash_node_constructor&lt;std::allocator&lt;std::pair&lt;long const, mds::InstrumentData*&gt; &gt;, boost::unordered_detail::ungrouped&gt;::construct_pair&lt;long, mds::InstrumentData*&gt; (this=0x53c67f90, k=@0xcab44a0)
    at /usr/include/boost/unordered/detail/util.hpp:267
#5  0x00007fcbeb7b9497 in boost::unordered_detail::hash_unique_table&lt;boost::unordered_detail::map&lt;long, boost::hash&lt;long&gt;, std::equal_to&lt;long&gt;, std::allocator&lt;std::pair&lt;long const, mds::InstrumentData*&gt; &gt; &gt; &gt;::operator[] (this=0x472d3a0, k=@0xcab44a0)
    at /usr/include/boost/unordered/detail/unique.hpp:203
#6  0x00007fcbeb7b787f in boost::unordered_map&lt;long, ProcessObject*, boost::hash&lt;long&gt;, std::equal_to&lt;long&gt;, std::allocator&lt;std::pair&lt;long const, ProcessObject*&gt; &gt; &gt;::operator[] (
    this=0x472d3a0, k=@0xcab44a0)
</code></pre>

<p>If I further go to the allocator source (as suggested in stack trace)</p>

<pre><code>  // NB: __n is permitted to be 0.  The C++ standard says nothing
  // about what the return value is when __n == 0.
  pointer
  allocate(size_type __n, const void* = 0)
  {
    if (__builtin_expect(__n &gt; this-&gt;max_size(), false))
      std::__throw_bad_alloc();
    return static_cast&lt;_Tp*&gt;(::operator new(__n * sizeof(_Tp))); (The line which was resonpsible for crash)
  }
</code></pre>

<p>I do not use any custom allocator within map. However our programs are linked against the tcmalloc package.
Is this a memory problem? Do I need to do some pre-allocations to be prepared for such scenario</p>
