In fixing the std:max problem with the earlier patch, I noticed we could do better here by adjusting how the allocator hysteresis is used.
Except in the initialization case, if we needed more than double the buffer, the original code would allocate exactly the amount needed, and thus consequently the next request would also realloc. Just add the hysteresis to what we need everytime we know we're going to allocate. As the first request is probably a few bytes, avoid allocating just over 1K by dialing the hysteresis back a bit.