quinn
quinn copied to clipboard
Recover send buffer memory on receipt of out-of-order ACKs
If the peer acknowledges a sufficiently large segment of data in the middle of a stream, but has not acknowledged data prior to it, we should act to free the no-longer-necessary memory, similarly to how we currently defragment out-of-order stream data in Assembler. This would significantly improve our worst-case bounds on send buffer memory use.
One approach would be to fragment the send buffer into discontinuous segments backed by a single BytesMut allocation if the proportion of acknowledged data remaining in memory exceeds some threshold (say, 25%). The exact threshold chosen represents a point on a tradeoff spectrum between CPU time (to copy data into the fresh allocation) and memory (wasted on acknowledged data).
This should be addressed only after #699 is merged, as it rewrites the code involved.