'new Function(...).call() creates a memory leak in chrome
function test() {
}
for (var i = 0; i < 10000; i ++) {
(new Function(`with(this) { return ${ test }}`)).call({ hello: 'world' });
}
And the live code I am actually triyng to debug is
const ret = (new Function(`with(this) { return ${$eval}}`))
.call({ moment, ...context });
This creates a memory leak and so does eval ( ie eval("test();"); in the for loop ).
I don't know how to work around this and I would expect it to not leak memory considering this answer: Memory leak using window.eval() in Firefox?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
