From c2c6d2b0351b15a26e10f9817f0789cc354d16af Mon Sep 17 00:00:00 2001 From: ywave620 <60539365+ywave620@users.noreply.github.com> Date: Fri, 31 Jan 2025 23:22:31 +0800 Subject: [PATCH] http: be more generational GC friendly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid any potential ref to Buffer in new generation from old generation PR-URL: https://github.com/nodejs/node/pull/56767 Reviewed-By: Paolo Insogna Reviewed-By: Gerhard Stöbich Reviewed-By: Chengzhong Wu --- lib/_http_outgoing.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 56676b4d73e..7c663920188 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -1172,6 +1172,8 @@ OutgoingMessage.prototype._flushOutput = function _flushOutput(socket) { // Refs: https://github.com/nodejs/node/pull/30958 for (let i = 0; i < outputLength; i++) { const { data, encoding, callback } = outputData[i]; + // Avoid any potential ref to Buffer in new generation from old generation + outputData[i].data = null; ret = socket.write(data, encoding, callback); } socket.uncork();