Repository navigation
Conversation
Each inline custom emoji adds a level of Text concatenation and SwiftUI resolves them recursively. The post from the issue has 784 emoji and overflows the 1 MB main thread stack on iPhone. Related to Dimillian#2531
Owner
|
Thanks! |
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.
Opening the post from #2531 crashes the app on iPhone. It has 784 custom emoji and every inline emoji adds another level of Text concatenation, which SwiftUI resolves recursively. On a phone the main thread stack is 1 MB and it runs out.
It does not show up in the simulator because the simulator has an 8 MB stack. I relinked with a 1 MB stack to match a device. 300 emoji render fine, 350 crash.
So above 100 emoji we now show the shortcodes as text instead of images. Posts with fewer emoji are not affected.
The proper fix would be in EmojiText, building the Text as a balanced tree instead of a chain. That is a separate repo, so this keeps the app from crashing for now.
Related to #2531