http: be more generational GC friendly

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 <paolo@cowtech.it>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
ywave620 2025-01-31 23:22:31 +08:00 committed by Marco Ippolito
parent 0c0fbfa9c6
commit c2c6d2b035
No known key found for this signature in database
GPG Key ID: 27F5E38D5B0A215F

View File

@ -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();