Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7d66752

Browse filesBrowse files
mdlavinMyles Borins
authored andcommitted
zlib: release callback and buffer after processing
PR-URL: #6955 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yuval Brik <yuval@brik.org.il>
1 parent 4c423e6 commit 7d66752
Copy full SHA for 7d66752

File tree

Expand file treeCollapse file tree

1 file changed

+10
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-0
lines changed
Open diff view settings
Collapse file

‎lib/zlib.js‎

Copy file name to clipboardExpand all lines: lib/zlib.js
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,16 @@ Zlib.prototype._processChunk = function(chunk, flushFlag, cb) {
560560
req.callback = callback;
561561

562562
function callback(availInAfter, availOutAfter) {
563+
// When the callback is used in an async write, the callback's
564+
// context is the `req` object that was created. The req object
565+
// is === this._handle, and that's why it's important to null
566+
// out the values after they are done being used. `this._handle`
567+
// can stay in memory longer than the callback and buffer are needed.
568+
if (this) {
569+
this.buffer = null;
570+
this.callback = null;
571+
}
572+
563573
if (self._hadError)
564574
return;
565575

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.