ffi: support Symbol.dispose on DynamicLibrary#62925
Open
mcollina wants to merge 2 commits intonodejs:mainfrom
Open
ffi: support Symbol.dispose on DynamicLibrary#62925mcollina wants to merge 2 commits intonodejs:mainfrom
mcollina wants to merge 2 commits intonodejs:mainfrom
Conversation
Collaborator
|
Review requested:
|
bengl
reviewed
Apr 24, 2026
| toArrayBuffer, | ||
| } = internalBinding('ffi'); | ||
|
|
||
| ObjectDefineProperty(DynamicLibrary.prototype, SymbolDispose, { |
Member
There was a problem hiding this comment.
Why not just do a normal assignment here? That seems to be the norm in the rest of the codebase. (e.g. Timers, ChildProcess, Readline)
bengl
approved these changes
Apr 24, 2026
ShogunPanda
approved these changes
Apr 24, 2026
addaleax
approved these changes
Apr 24, 2026
Collaborator
Member
Author
|
Commit not validating due to nodejs/core-validate-commit#146 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #62925 +/- ##
==========================================
- Coverage 91.47% 89.65% -1.83%
==========================================
Files 357 708 +351
Lines 150883 220331 +69448
Branches 23778 42257 +18479
==========================================
+ Hits 138026 197536 +59510
- Misses 12582 14654 +2072
- Partials 275 8141 +7866
🚀 New features to boost your workflow:
|
Collaborator
Contributor
|
@mcollina You're now missing a Signed-Off. once you add I'll approve and merge. |
6da4424 to
3ea2ef6
Compare
ShogunPanda
approved these changes
Apr 27, 2026
Collaborator
Collaborator
Adds microbenchmarks covering the common FFI call shapes so future changes to the invoker can be evaluated: - add-i32.js: 2-arg integer - add-f64.js: 2-arg float - many-args.js: 6-arg integer - pointer-bigint.js: 1-arg pointer (BigInt) - sum-buffer.js: pointer + length (Buffer) A `common.js` helper resolves the fixture-library path from `test/ffi/fixture_library` without pulling in the test harness, and throws a clear message if the fixture hasn't been built yet. Also adds `sum_6_i32` to the fixture library for the many-args case. Signed-off-by: Bryan English <bryan@bryanenglish.com> PR-URL: nodejs#62918 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Install [Symbol.dispose]() on DynamicLibrary.prototype (calling close()) and on the object returned from ffi.dlopen(), so both can be used with the `using` declaration for automatic cleanup. Signed-off-by: Matteo Collina <hello@matteocollina.com>
3ea2ef6 to
aacdb0d
Compare
ShogunPanda
approved these changes
Apr 28, 2026
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Install
Symbol.disposeonDynamicLibrary.prototype(callingclose()) and on the object returned fromffi.dlopen(), so both can be used with theusingdeclaration for automatic cleanup.