From ba4587c9fc5fae8334f3368be89405ca5735f3bb 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 23b850d1522c97..5816a34efa4ace 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -1218,6 +1218,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();