[Webkit-unassigned] [Bug 150295] New: [ES6] Typical Promise chain easily exhaust memory

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Oct 17 21:41:59 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=150295

            Bug ID: 150295
           Summary: [ES6] Typical Promise chain easily exhaust memory
    Classification: Unclassified
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: utatane.tea at gmail.com

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

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20151018/ecef5a73/attachment.html>


More information about the webkit-unassigned mailing list