We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4c423e6 commit 7d66752Copy full SHA for 7d66752
lib/zlib.js
@@ -560,6 +560,16 @@ Zlib.prototype._processChunk = function(chunk, flushFlag, cb) {
560
req.callback = callback;
561
562
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
+
573
if (self._hadError)
574
return;
575
0 commit comments