
5 Dec
2019
5 Dec
'19
1:39 p.m.
Folks, we are way overthinking the behavior of resize() over capacity(). It throws for a very simple reason. The most obvious and common optimization for highly concurrent network programs is simply to avoid the global allocator. And the obvious and common mitigation for resource exhaustion attacks is to limit the amount of data that an I/O handler is allowed to process. Using a fixed string as a temporary buffer for an algorithm satisfies both of these goals, and it does so without the caller having to write a bunch of code to check sizes in advance. Thanks