quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.85k stars 394 forks source link

Do not pre-allocate memory on streams #1682

Closed jeromegn closed 1 year ago

jeromegn commented 1 year ago

This PR wraps Recv and Send streams in Option<Box<T>> to prevent significant memory pre-allocation.

Still a few things to verify / do:

(Hopefully) Fixes #1677

jeromegn commented 1 year ago

I have tested this in corrosion and it significantly reduced memory usage. As far as I can tell everything is working as intended but I'd like somebody to thoroughly review it.

jeromegn commented 1 year ago

Shall we merge or are we waiting for a commit history cleanup from me? :)

djc commented 1 year ago

I have a cleaned up branch but was failing to push it up to your remote... let me just push it here.

djc commented 1 year ago

See #1685. Might do more golfing later. @jeromegn would you mind forward porting?

jeromegn commented 1 year ago

Made a PR for the forward port: https://github.com/quinn-rs/quinn/pull/1686