Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement transferable ArrayBuffer for use in postMessage #11583

Closed
johnspurlock opened this issue Aug 4, 2021 · 2 comments
Closed

Implement transferable ArrayBuffer for use in postMessage #11583

johnspurlock opened this issue Aug 4, 2021 · 2 comments
Labels
duplicate a duplicate of another issue

Comments

@johnspurlock
Copy link
Contributor

In browsers, sending large array buffers over postMessage, for example to a Worker, can be optimized by indicating that an ArrayBuffer (which is Transferable) should transfer ownership, instead of being cloned. See the transfer parameter to postMessage on MDN.

This does not appear to be working in Deno 1.12.2: const tmp = new Uint8Array(0); w.postMessage({ tmp }, [ tmp.buffer ]); throws DOMException: Value not transferable - yet const tmp = new Uint8Array(0); w.postMessage({ tmp }, [ ]); succeeds.

There is a related issue #8341, but it's far more broad - this issue is requesting only ArrayBuffer support, which is part of the spec all browsers implement.

@kitsonk kitsonk added the duplicate a duplicate of another issue label Aug 4, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Aug 4, 2021

Duplicate of #8341

@kitsonk kitsonk marked this as a duplicate of #8341 Aug 4, 2021
@kitsonk kitsonk closed this as completed Aug 4, 2021
@lucacasonato lucacasonato marked this as not a duplicate of #8341 Aug 5, 2021
@lucacasonato
Copy link
Member

lucacasonato commented Aug 5, 2021

I don't think it is a duplicate of #8341. This issue is specific to ArrayBuffer, while the #8341 talks about general resources (Deno.Conn for example). I am going to work on this once I am back from vacation. It is definitely a duplicate of #11303 though :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants