Skip to content

Commit 74548ce

Browse files
committed
Setting _this to null to workaround a bug in V8 that keeps Compilation object alive and makes node run out of memory: https://bugs.chromium.org/p/chromium/issues/detail?id=612191
1 parent 729cbed commit 74548ce

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎lib/Compilation.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,12 @@ Compilation.prototype.addModuleDependencies = function(module, dependencies, bai
319319

320320
});
321321
}, function(err) {
322+
// In V8, the Error objects keep a reference to the functions on the stack. These warnings &
323+
// errors are created inside closures that keep a reference to the Compilation, so errors are
324+
// leaking the Compilation object. Setting _this to null workarounds the following issue in V8.
325+
// https://bugs.chromium.org/p/chromium/issues/detail?id=612191
326+
_this = null;
327+
322328
if(err) {
323329
return callback(err);
324330
}

0 commit comments

Comments
 (0)