-
Notifications
You must be signed in to change notification settings - Fork 190
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
nodejs c-addon seems to leak #819
Comments
calling like below collect and print message as expected. context.eval("js", """
const myModule = require('uv_file_convert');
for (let i = 0; i < 5; i++) {
const coo = myModule.makeBlockWrapper(() => {})
console.log(i)
coo.close();
}
foo.close()
gc();
""".trimIndent())
} but if I extract the object into polygot in seems not to recognize the unreferencing. val wrappedValue = context.eval("js", """
const myModule = require('uv_file_convert');
myModule.makeBlockWrapper(() => {})
""".trimIndent())
wrappedValue.invokeMember("close")
context.eval("js", """
for (let i = 0; i < 5; i++) {
const coo = myModule.makeBlockWrapper(() => {})
console.log(i)
coo.close();
}
foo.close()
// deinit and deinit 22 is called only 5 times
gc();
""".trimIndent()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems GraalVM under nodeJS does not garbage collect native object well.
I have simple Node-addon-api base native addon which create Napi::ThreadSafeFunction to use in JVM
I had to build this against standard NodeJS, since GraalVM+NodeJS does not expose library to link with (see oracle/graal#7063 ).
If I execute javascript with --expose-gc on Node output is different between normal NodeJS and Graal. REPL
NodeJS
GraalJS
what's worse is that if I callmyModule.makeBlockWrapper(() => {})
using Context api from java code, gc print message one less than it should be.this code block seems to work as expected,
The text was updated successfully, but these errors were encountered: