-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
n-api: does napi_create_external_buffer copy? #33471
Comments
Did some testing and it seems to be not memcopying it. If other people agree that this is the correct behaivour and that the docs are confusing I can volunteer a PR |
Yes, this is an error in the docs, it does not copy (and there would be no point in doing so for externalized buffers anyway). |
@mafintosh a PR for the docs would be great. |
gabrielschulhof
pushed a commit
to gabrielschulhof/node
that referenced
this issue
Jun 29, 2020
Remove text regarding copying, because `napi_create_external_buffer` does not copy. Fixes: nodejs#33471
2 tasks
MylesBorins
pushed a commit
that referenced
this issue
Jul 14, 2020
Remove text regarding copying, because `napi_create_external_buffer` does not copy. Fixes: #33471 PR-URL: #34125 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Mathias Buus <[email protected]> Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
MylesBorins
pushed a commit
that referenced
this issue
Jul 16, 2020
Remove text regarding copying, because `napi_create_external_buffer` does not copy. Fixes: #33471 PR-URL: #34125 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Mathias Buus <[email protected]> Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
addaleax
pushed a commit
that referenced
this issue
Sep 22, 2020
Remove text regarding copying, because `napi_create_external_buffer` does not copy. Fixes: #33471 PR-URL: #34125 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Mathias Buus <[email protected]> Reviewed-By: Zeyu Yang <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hunting down a bug related to napi_create_external_buffer, I got a bit confused by reading the docs here:
https://nodejs.org/dist/latest-v14.x/docs/api/n-api.html#n_api_napi_create_external_buffer
[in] data: Raw pointer to the underlying buffer to copy from.
Does this mean that the buffer is created with the same pointer or a new pointer that's a memcopy?
Further down on the docs for the same method it also says:
This API allocates a node::Buffer object and initializes it with data backed by the passed in buffer.
Which I'm also not sure wheather to interpret as a memcopy
The text was updated successfully, but these errors were encountered: