-
Notifications
You must be signed in to change notification settings - Fork 459
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
External data lifetime for Buffer and ArrayBuffer #258
Comments
Per discussion today investigate mimicking the NAN behavior. |
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. |
@NickNaso will review and lead the discussion in a future team meeting. |
Touched on in the meeting today, no update, but @NickNaso still looking at it. |
Hi everybody, I did not have the time to work on issue until today. I'm starting work on this now, I will update at next Node-API meeting. |
@NickNaso will modify the |
While writing up the documentation for
Buffer
andArrayBuffer
I came across some suspicious looking factory methods:Digging through the code a bit, it appears that these methods take in a pointer to data and then create an external wrapper object with no finalizer.
Looking at the NAN documentation for buffers it seems like the behavior is to take ownership of the memory and then later
free
it. Even NAN's approach is arguably dangerous since it makes assumptions about how and where the memory was allocated.Since
node-addon-api
doesn't actually free the data and doesn't provide any way for the user to free the data, the only use case I can see for this API is for data which has a static lifetime.Given their limited (and dangerous) usage, maybe we should consider removing these overloads?
The text was updated successfully, but these errors were encountered: