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
If you comment out the code in the closure, you'll see that app gets garbage collected.
Our theory is that the reference to the JS closure kept in the Rust implementation is seen as a root by the garbage collector. One approach we discussed as a remedy would be to store all the callback closures inside the JS object (as properties in an array perhaps), instead of using a strong napi::Ref that becomes a root.
The text was updated successfully, but these errors were encountered:
The following test case should print "deleted" to indicate that we're not leaking memory.
Run inside
api/napi
, alongside atest.slint
:Run with
node --expose-gc ./test.js
If you comment out the code in the closure, you'll see that
app
gets garbage collected.Our theory is that the reference to the JS closure kept in the Rust implementation is seen as a root by the garbage collector. One approach we discussed as a remedy would be to store all the callback closures inside the JS object (as properties in an array perhaps), instead of using a strong
napi::Ref
that becomes a root.The text was updated successfully, but these errors were encountered: