canvas: Adjust memory pressure heuristic - #46786
Merged
Merged
Conversation
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
sagudev
approved these changes
Jul 26, 2026
Co-authored-by: Sam <16504129+sagudev@users.noreply.github.com> Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
yezhizhen
reviewed
Jul 27, 2026
Comment on lines
+62
to
+63
| /// On mobile devices this slightly undercounts (usually unified memory), on desktop this | ||
| /// slightly overcounts, since GPU memory is separate. |
Member
There was a problem hiding this comment.
I understand on Desktop this overcounts because VRAM is independent.
But why it undercounts on mobile tho?
Member
Author
There was a problem hiding this comment.
I guess it's not totally accurate as written. In your test case for canvas 2d performance point 2 is more than 1 bitmap size, but it varies by scene so it can also be less. With vello GPU I think it would always be more than 1 bitmap size, but I didn't want to complicate things more, and leaving backend accuracy to the Todo tracked by the new issue.
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.
With the testcase from #45199 memory usage grew to 1.7 GiB before stabilizing. With this patch it stopped at around 1GiB (due to more frequent GCs).
We probably should be able to remove at least one of the copies in memory, but thats a bit more effort than making the memory pressure more accurate.
Testing: We don't have any tests for GC behavior / memory usage.