Repository navigation
Conversation
…hread Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tomekzaw
marked this pull request as ready for review
October 30, 2026 22:03
javache
approved these changes
Oct 30, 2026
|
@javache has imported this pull request. If you are a Meta employee, you can view this in D128714083. |
tomekzaw
force-pushed
the
fix-sync-update-local-ref
branch
from
November 2, 2026 17:00
12d3a34 to
6873b79
Compare
This branch has not been 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.
Summary:
FabricMountingManager::synchronouslyUpdateViewOnUIThreadcreates aReadableNativeMapfor the props and calls.release()on its local reference, so nothing deletes it. The C++ animation backend calls this once per animated view on every frame: for every view whenoptimizedAnimatedPropUpdatesis off, and for views with layout updates otherwise. So each props map stays alive until the frame callback returns to Java. A frame that animates 600 views holds 600 local references. Android 7, the oldest supported version, limits a thread to 512 local references and aborts above that.This wraps the reference in
jni::adopt_local, likedispatchCommandabove it, so each map is released after its call.Changelog:
[ANDROID] [FIXED] - Release the JNI local reference to the props map in
synchronouslyUpdateViewOnUIThreadTest Plan:
Release RNTester (
./gradlew :packages:rn-tester:android:app:assembleRelease -PreactNativeArchitectures=arm64-v8a) with these temporary, uncommitted changes:cxxNativeAnimatedEnabledanduseSharedAnimatedBackendare on andoptimizedAnimatedPropUpdatesis off.translateXof 600 views withuseNativeDriver: true.synchronouslyUpdateViewOnUIThreadcall.On a Galaxy A16 (Android 16):
mainOn
main, every call starts on a new slot because the earlier maps are still referenced. With this change, every call reuses the same slot.Performance, with the same setup (600 views moved by one native-driven animation), timed per animation frame (Java timer around
driveAnimationBackend, which includes freeing the local references when it returns) and persynchronouslyUpdateViewOnUIThreadcall (C++ timer):synchronouslyUpdateViewOnUIThreadcallSetup:
cmd package compile -m speed.mainand this PR (16 processes per build).Not run: Android 7, where the 512-reference limit would turn this into a crash; I don't have a device with it.
🤖 Generated with Claude Code