Skip to content

Fix memory leak in TextInput#55719

Closed
mobinni wants to merge 2 commits intofacebook:mainfrom
mobinni:text-input-memory-leak
Closed

Fix memory leak in TextInput#55719
mobinni wants to merge 2 commits intofacebook:mainfrom
mobinni:text-input-memory-leak

Conversation

@mobinni
Copy link
Contributor

@mobinni mobinni commented Feb 24, 2026

Summary:

When implementing a local FPS monitor I noticed that TextInput leaked memory. @tomekzaw helped triage and confirm whether the leak was occurring in reanimated or react-native upstream.

We collaborated on a fix for this and noticed that this was fixed 6 years ago in text here

We've ported the same fix to BaseTextInputShadowNode.h

Changelog:

[General] [Fixed] - Fix memory leak in TextInput

Test Plan:

https://snack.expo.dev/@mobinni/memory-leak-reproducer

  • Run this with XCode instruments and see memory grow over time
image

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 24, 2026
@mobinni mobinni marked this pull request as ready for review February 24, 2026 15:01
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Feb 24, 2026
@tomekzaw
Copy link
Contributor

Fixes software-mansion/react-native-reanimated#7647 as well.

@javache
Copy link
Member

javache commented Feb 24, 2026

Thanks! We should really use a different data structure than ShadowView in AttributedString...

@meta-codesync
Copy link

meta-codesync bot commented Feb 24, 2026

@javache has imported this pull request. If you are a Meta employee, you can view this in D94267721.

@meta-codesync meta-codesync bot closed this in 5229e50 Feb 25, 2026
@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @mobinni in 5229e50

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants