Skip to content

Commit 119af18

Browse files
authored
Merge pull request webpack#2497 from achicu/achicu/fix_error_memory_leak
Fixing memory leak causing node go out of memory
2 parents 5bef13e + 74548ce commit 119af18

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)