profile mode fix
Jonathan Wakely
jwakely.gcc@gmail.com
Wed Feb 5 12:59:00 GMT 2014
On 30/01/14 22:05 +0100, François Dumont wrote:
> Do you think then that using a special allocator implementation
> with a one element cache to make sure that a std::unordered_map
> insert preceded by an erase won't throw could be interested ? If
> not I will simply remove it from my TODOs list.
It could be useful for some scenarios, but I don't think it's
important. If you're so short of memory that a single cached element
makes the difference between a successul insertion and std::bad_alloc
then won't the program still run out of memory soon anyway?
With std::allocator an erase will free memory, so if it is already
re-used by the time you want to insert then something else in your
program is consuming all the available memory, and using a custom
allocator in one container isn't going to prevent it.
Also, with the default VM configuration on GNU/Linux the VM system
will overcommit and you'll never get std::bad_alloc, the program will
become unresponsive, segfault, or get OOM killed first.
But if you think it would be interesting then you should of course try
it out :-)
More information about the Libstdc++
mailing list