From f011dfb23462ab85cf95c9efa3b53653726c6d7a Mon Sep 17 00:00:00 2001 From: asonix Date: Sat, 18 May 2024 12:31:41 -0500 Subject: [PATCH 1/2] actix-web-actors: take the internal buffer when yielding --- actix-web-actors/src/ws.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actix-web-actors/src/ws.rs b/actix-web-actors/src/ws.rs index 1fb9032251a..7f7607fa95d 100644 --- a/actix-web-actors/src/ws.rs +++ b/actix-web-actors/src/ws.rs @@ -710,7 +710,7 @@ where } if !this.buf.is_empty() { - Poll::Ready(Some(Ok(this.buf.split().freeze()))) + Poll::Ready(Some(Ok(std::mem::take(&mut this.buf).freeze()))) } else if this.fut.alive() && !this.closed { Poll::Pending } else { From 7c1663c4731749895e9502d10ff3aab50f7111f6 Mon Sep 17 00:00:00 2001 From: asonix Date: Sat, 18 May 2024 13:47:45 -0500 Subject: [PATCH 2/2] actix-web-actors: Add CHANGES entry re: taking buffer --- actix-web-actors/CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/actix-web-actors/CHANGES.md b/actix-web-actors/CHANGES.md index 9a622d8da98..3e854c0b88d 100644 --- a/actix-web-actors/CHANGES.md +++ b/actix-web-actors/CHANGES.md @@ -2,6 +2,7 @@ ## Unreleased +- Take the encoded buffer when yielding bytes in the response stream rather than splitting the buffer, reducing memory use - Minimum supported Rust version (MSRV) is now 1.72. ## 4.3.0