Repository navigation
Conversation
Kotlin ArrayBuffer now implements AutoCloseable. close() releases the native or JS-backed memory right away instead of waiting for the Java GC. Later access throws an IllegalStateException, and debug builds throw a clear error when a closed buffer is passed to JS or C++.
|
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.
Kotlin
ArrayBuffernow implementsAutoCloseable.close()resets itsHybridData, sobuffer.use { }releases native or JS-backed memory right away instead of waiting for the Java GC. Other owners (JS, C++) keep the memory until they release it too.IllegalStateException. Debug builds also throw a clear error when a closed buffer is passed to JS or C++.isClosedproperty.I left the generated JNI bridge alone instead of closing JS-backed parameters after a synchronous call. A JS-backed
ArrayBufferkeeps its JS object alive, so C++ and Swift implementations can store one and return it later on the JS thread. Closing it automatically would break that in Kotlin.close()isn't observable from JS by itself. Thewrap(..., onDelete)PR in this stack adds shared tests where the Kotlin fixture releases its reference withclose().Tested on an API 36 emulator: the
array-buffersruntime suite passes with this PR alone.🤖 Generated with Claude Code