Closed Bug 1514051 Opened 5 years ago Closed 5 years ago

Release underlying source when a stream becomes closed or errored (ReadableStreamControllerClearAlgorithms)

Categories

(Core :: JavaScript Engine, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: jorendorff, Assigned: jorendorff)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

When a ReadableStream becomes closed or errored, it doesn't need to hang on to any system resources associated with the underlying source. The standard actually specifies that the internal slots keeping it alive are nulled out. We don't yet implement this, in most code paths.
Summary: ReadableStreamControllerClearAlgorithms should release external stream sources → Release underlying source when a stream becomes closed or errored (ReadableStreamControllerClearAlgorithms)
Also in this bug:
* fix ReadableStreamControllerClearAlgorithm(controller) to free external stream sources
* make sure it frees the upstream source if it's a tee controller

Currently it only frees anything if the stream is a pure-JS stream created with `new ReadableStream(source)`. And even then it doesn't actually free the source. Oops.
I think it's a little bizarre for this to be part of the standard, but if it
weren't there, I wouldn't know it was safe to do this.
Pushed by jorendorff@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bd071dbcecad
Part 1: Drop GC edges when a stream is no longer readable. r=arai
https://hg.mozilla.org/integration/autoland/rev/4b9bf0633280
Part 2: Drop the underlying source along with other GC edges in ReadableStreamControllerClearAlgorithms. r=arai
Pushed by jorendorff@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7167385d70ec
Part 1: Drop GC edges when a stream is no longer readable. r=arai
https://hg.mozilla.org/integration/autoland/rev/bc05036b8cbb
Part 2: Drop the underlying source along with other GC edges in ReadableStreamControllerClearAlgorithms. r=arai
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
Flags: needinfo?(jorendorff)
You need to log in before you can comment on or make changes to this bug.