This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Reclaim paragraph memory more aggressively#26438
Merged
yjbanov merged 3 commits intoflutter:masterfrom May 27, 2021
Merged
Conversation
Contributor
harryterkelsen
left a comment
There was a problem hiding this comment.
This approach seems good to me
| /// blowing up if within a single frame the framework needs to layout a lot of | ||
| /// paragraphs. One common use-case is `ListView.builder`, which needs to layout | ||
| /// more of its content than it actually renders to compute the scroll position. | ||
| void release() { |
Contributor
There was a problem hiding this comment.
I think this name is a little confusing. release makes me think we are telling the cache to delete this paragraph ASAP. I think something like addToCache or markUsed would make more sense
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
May 27, 2021
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
May 27, 2021
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
May 28, 2021
naudzghebre
pushed a commit
to naudzghebre/engine
that referenced
this pull request
Sep 2, 2021
* delete paragraphs between layout and render
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Put
CkParagraphobjects into a separate synchronous cache, which reclaims memory synchronously. This significantly reduces paragraph memory usage for very longListViews and other cases where lots of paragraphs are laid out but not rendered. It does not fully cover the use-case where we both lay out and render tons of paragraphs (it fixes the memory issue but not the performance issue). For that we need flutter/flutter#81224.Some benchmark numbers:
text_canvas_kit_color_grid: before 420MB, after 153MBLayout and render 10000 paragraphs: before 1GB, after 200MB
sample 1, 60 seconds (by @slavap): before 600MB, after 168MB
sample 2, 100 tab switches (by @asjqkkkk): before 422MB, after 253MB
Fixes flutter/flutter#66614