FYI: In V8, Error objects keep closures alive until the err.stack property is accessed, which prevents collection of the closure (and associated objects) until the Error objects die.
Mocha creates a long-living Error for each Runnable:
|
this._trace = new Error('done() called multiple times'); |
.
Would it make sense to either 1. store a string message instead of an Error, or 2. clear Error.stack, or 3. format Error.stack eagerly instead?
See also: https://crbug.com/v8/7142 and https://twitter.com/wSokra/status/935790750188625920.
FYI: In V8, Error objects keep closures alive until the
err.stackproperty is accessed, which prevents collection of the closure (and associated objects) until the Error objects die.Mocha creates a long-living Error for each Runnable:
mocha/lib/runnable.js
Line 56 in 2303c66
Would it make sense to either 1. store a string message instead of an Error, or 2. clear Error.stack, or 3. format Error.stack eagerly instead?
See also: https://crbug.com/v8/7142 and https://twitter.com/wSokra/status/935790750188625920.