-
Notifications
You must be signed in to change notification settings - Fork 1
Implementation of V1 buffer runtime functions #168
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
Conversation
|
console.log(addon.newBuffer().toLocaleString(), addon.theText); | ||
console.log("gc1"); | ||
console.log(addon.getDeleterCallCount(), 0); | ||
global.gc(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't expect this to be defined when running in React Native.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I can see Hermes C++ API does not provide a way to trigger a garbage collection. I think without patching the Hermes it won't be possible to run this part of test when running in React Native - please correct me if I am wrong. In this case I will remove it for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out I was wrong 🎉 globalThis.gc()
should be available 🦾
@paradowstack when you're ready to run the tests on Android and iOS you can add the two labels to the PR (not yet well documented). I just did this now, hope that's okay with you 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's okay to merge once the Android and iOS tests has passed and look forward to improving the tests with #147.
This PR brings in an implementation of following
V1
buffer runtime functions:napi_create_buffer
napi_create_buffer_copy
napi_is_buffer
napi_get_buffer_info
napi_create_external_buffer
It also introduces test addon, adopted from https://github.com/nodejs/node/tree/main/test/node-api/test_buffer, that is placed in
packages/node-addon-examples/tests/buffers
.