You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes you might want to return a value that is not scoped and then to
delete the reference to it at the same time. In order to do this, it may
be useful to add the value to the scope so that it can be returned.
N-API might automatically do this; the documentation isn't quite clear. If
N-API does already do this, it should be explained, and the stuff in this
section need not be implemented.
Another alternative would be to provide another function to return values
from a native code rather than returning it directly.
Another possibility may be to create an array and add the value into that
array to prevent it from getting lost, and the array is automatically lost
when the function returns, but that seems a bit klugy to me.
When you return from a native function everything (JavaScript Objects) allocated in the Scope for the native method are no longer held alive unless a reference to them has been passed to JavaScript (for example by calling a JavaScript function and passing as a parametr), stored in a Reference or returned by the native function.
I think that likely covers the case you were thinking of but I'm not 100% sure from your description.
Since there was no response for a number of years and the answer was that the case was likely covered closing. Please let us know if you think that was not the right thing to do.
Re: nodejs/node#14256
The text was updated successfully, but these errors were encountered: