vector<> can probably never grow to it's maximum size!

Paolo Carlini pcarlini@suse.de
Tue Oct 19 15:19:00 GMT 2004


Dhruv Matani wrote:

>And tries to explain more concretely what I'm trying to achieve and also
>shows that it's do able in current C++.
>
Why you keep on refusing to deal with one issue at a time?

The below cannot fix, not even in principle, the immediate problem that
we have with __len overflowing size_type: all the new tricks in __mt_alloc
are not in effect in this case, ::operator new for sure will never return
an address == _M_start (half the memory is already used), it will always
throw, even if you ask only for __old_size + 1. Don't try to achieve the
impossible, concentrate on the case of small memory allocations, managed
via mt_alloc memory pools: in that case there is rooom for improvement..

Paolo.



More information about the Libstdc++ mailing list