mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Deallocate JNI array after TextInput text measurement
Summary: Every time we measure a TextInput we allocate a JNI local array and weren't cleaning it up, leading to JNI table exhaustion. Changelog: [Internal] Differential Revision: D23670780 fbshipit-source-id: 2ecf9770c8593eeadd70a248be58037fefdca61e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
44229d9149
commit
0b3f46b564
+7
-1
@@ -88,6 +88,10 @@ TextMeasurement TextLayoutManager::measureCachedSpannableById(
|
||||
maximumSize.height,
|
||||
attachmentPositions));
|
||||
|
||||
// Clean up allocated ref - it still takes up space in the JNI ref table even
|
||||
// though it's 0 length
|
||||
env->DeleteLocalRef(attachmentPositions);
|
||||
|
||||
// TODO: currently we do not support attachments for cached IDs - should we?
|
||||
auto attachments = TextMeasurement::Attachments{};
|
||||
|
||||
@@ -172,8 +176,10 @@ TextMeasurement TextLayoutManager::doMeasure(
|
||||
}
|
||||
}
|
||||
}
|
||||
// DELETE REF
|
||||
|
||||
// Clean up allocated ref
|
||||
env->DeleteLocalRef(attachmentPositions);
|
||||
|
||||
return TextMeasurement{size, attachments};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user