-
Notifications
You must be signed in to change notification settings - Fork 464
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
Neutering ArrayBuffer #541
Comments
I think today the answer is no. Is it part of the ES spec? We work to ensure that we avoid implementation-specific features which might not be available on all JavaScript runtimes? If it is in the ES spec can you point us to the section in the spec? |
Neuter is a super super super old (that link is to node 0.12) method that is now better known as Detach: https://cs.chromium.org/chromium/src/v8/include/v8.h?l=4867&rcl=7720ac9d21ceeaa24715da66d11c0437010fbdee https://tc39.es/ecma262/#sec-detacharraybuffer I agree this is a useful thing to have. |
@devsnek same question then, is Detach part of the ES spec? |
@mhdawson yeah, second link there is the operation to detach an arraybuffer in the es spec. |
@devsnek thanks for the pointers. One more question. I can understand "useful" but wondering about how widely used it might be. Do you think it would be widely used if available? |
In the ecosystem the operation exists for two reasons: 1) postMessage detaches arraybuffers that you pass to it, and 2) wasm memory is detached when it is resized. I can't really extrapolate that to anything specific, but I'm sure there are other use cases. @maierfelix do you have a use case? |
I found this test in blink for webgpu buffer mapping. I work on a webgpu api for node and couldn't find a way to detach through napi, just by: let array = new Int8Array(new ArrayBuffer(100));
window.postMessage(array, "*", [array.buffer]); |
This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made. |
We now have IsDetached() and Detach() support in N-API 7 closing. |
In v8, I see a method to neuter/detach an ArrayBuffer. Is there a way to this in NAPI and also gets exposed here?
The text was updated successfully, but these errors were encountered: