mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
http: reset parser.incoming when server response is finished
This resolves a memory leak for keep-alive connections with a naïve approach. Fixes: https://github.com/nodejs/node/issues/9668 PR-URL: https://github.com/nodejs/node/pull/28646 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
35cb955865
commit
779a05d5d1
@ -621,6 +621,8 @@ function resOnFinish(req, res, socket, state, server) {
|
||||
assert(state.incoming.length === 0 || state.incoming[0] === req);
|
||||
|
||||
state.incoming.shift();
|
||||
// Reset the .incoming property so that the request object can be gc'ed.
|
||||
if (socket.parser) socket.parser.incoming = null;
|
||||
|
||||
// If the user never called req.read(), and didn't pipe() or
|
||||
// .resume() or .on('data'), then we call req._dump() so that the
|
||||
|
Loading…
Reference in New Issue
Block a user