Skip to content

refactor(napi_wrap): make user provide Ref#10

Merged
wemeetagain merged 1 commit intomainfrom
bing/ref-update
Mar 24, 2026
Merged

refactor(napi_wrap): make user provide Ref#10
wemeetagain merged 1 commit intomainfrom
bing/ref-update

Conversation

@spiral-ladder
Copy link
Contributor

We still want the option of the user providing the Ref if they want to
hold the reference to the created napi object.

This is a fix for bls integration on lodestar suffering from a memory leak - because our usage of our bls bindings in lodestar-z involves us doing a _ = Env.wrap,
we drop the reference to the napi object while increasing the refcount,
which means our finalize calls from the v8 GC is never called.

We still want the option of the user providing the `Ref` if they want to
hold the reference to the created napi object.

This is a fix for bls integration on lodestar suffering from a memory leak - because our usage of our bls bindings in lodestar-z involves us doing a `_ = Env.wrap`,
we drop the reference to the napi object while increasing the refcount,
which means our finalize calls from the v8 GC is never called.
@wemeetagain wemeetagain changed the title refactor: make user provide Ref refactor(napi_wrap): make user provide Ref Mar 24, 2026
@wemeetagain wemeetagain merged commit 6cb16f8 into main Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants