NEW150295
[ES6] Typical Promise chain easily exhaust memory
https://bugs.webkit.org/show_bug.cgi?id=150295
Summary [ES6] Typical Promise chain easily exhaust memory
Yusuke Suzuki
Reported 2015-10-17 21:41:59 PDT
This is originally reported in Chromium/Blink context[1]. In the following example, ```js "use strict"; var p = null; (function () { var N = 1000 * 1000; var counter = 0; var resolve; function read() { return Promise.resolve({done: ++counter >= N}); } function pump() { return read().then(function(r) { if (counter % 10000 == 0) gc(); if (r.done) { return; } return pump(); }); } p = pump(); }()); ``` Since it chains promises like `a => b => c => ... too much promises => final`, if there are too much promises, it exhausts memory. This behavior is well-specified correct behavior, but in practice, we would like to collect / reduce these promises. [1]: https://github.com/domenic/streams-demo/issues/4
Attachments
Note You need to log in before you can comment on or make changes to this bug.