Skip to content

Commit

Permalink
http: be more generational GC friendly
Browse files Browse the repository at this point in the history
Avoid any potential ref to Buffer in new generation
from old generation

PR-URL: #56767
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
  • Loading branch information
ywave620 authored Jan 31, 2025
1 parent 261624b commit ba4587c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/_http_outgoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit ba4587c

Please sign in to comment.