[Bug libstdc++/70794] vector.push_back() crashes with std::bad_alloc after 2^32 calls

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 11 10:24:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70794

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |INVALID

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
You're running out of memory. Growing beyond 4294967297 chars will double the
vector's size, which will allocate 8GiB in addition to the 4GiB already used by
the vector. Before it can copy the elements to the new storage and free the old
4GiB it runs out of memory.


More information about the Gcc-bugs mailing list