Repository navigation
Conversation
Add ArrayBuffer.wrap(byteBuffer, onDelete) and a HardwareBuffer overload, matching Swift's wrap(dataWithoutCopy:size:onDelete:) and C++'s ArrayBuffer::wrap(data, size, deleteFn). onDelete runs once the last owner released the buffer, so users can close an Image, release a MediaCodec output buffer or return a pooled buffer. The callback can run on Hermes' GC thread, so the destructor attaches only when needed, and errors are reported to the GlobalErrorHandler.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
mrousavy
added this pull request to stack #2005
October 23, 2026 12:37
mrousavy
removed this pull request from stack #2005
October 23, 2026 12:37
mrousavy
added this pull request to stack #2006
October 23, 2026 12:37
mrousavy
removed this pull request from stack #2006
October 23, 2026 17:52
mrousavy
added this pull request to stack #2007
October 23, 2026 17:52
This branch was successfully deployed
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.
Adds
ArrayBuffer.wrap(byteBuffer, onDelete)andArrayBuffer.wrap(hardwareBuffer, onDelete), matching Swift'swrap(dataWithoutCopy:size:onDelete:)and C++'sArrayBuffer::wrap(data, size, deleteFn).onDeleteruns once the last owner (JS or native) has released the buffer, e.g. to close anImage, release aMediaCodecoutput buffer, or return a pooled buffer.ByteBufferArrayBufferandHardwareBufferArrayBufferkeep a global ref to aRunnableand run it from their destructor.resetGlobalRef.onDeletego to theGlobalErrorHandlerand don't terminate the app.New shared cases in
array-buffers.test.ts, implemented in the C++, Swift and Kotlin fixtures, check that a wrapped buffer is deleted exactly once, after both JS and native released it, in either order.Tested with this PR alone: the
array-bufferssuite on an API 36 emulator and the full iOS runtime suite on an iOS 26.5 simulator pass.🤖 Generated with Claude Code