Re: [whatwg/streams] Reject pending reads when releasing reader (#1168)

@domenic commented on this pull request.



> +   1. Perform ? [$ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue$](|controller|,
+      |firstPendingPullInto|).

> so it would be nice if we could just "shrink" that buffer somehow without reallocating...

In theory, it feels like transferring or some variant could do this. In practice though, if we're in a situation where ArrayBuffer allocations are failing, I'm not confident we can depend on transferring to avoid such failures itself. I.e., in spec land, transfer might be shrink-in-place, but in implementations, it might need temporary buffers or some allocations or something.

So,

> If we can't prevent data loss, should we error the stream instead?

sounds reasonable to me.

In general I assume these out-of-memory cases are either (1) your computer is in trouble, let's just start erroring as soon as possible to avoid further problems; or (2) you are manipulating huge buffers, and you probably shouldn't be doing that, so let's give you an error so that you can tune your application code to do less huge buffers.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/1168#discussion_r779034631
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/streams/pull/1168/review/844914463@github.com>

Received on Wednesday, 5 January 2022 18:12:41 UTC