Fix two memory leaks in InkWell and ObservableList#38767
Closed
ds84182 wants to merge 1 commit intoflutter:masterfrom
Closed
Fix two memory leaks in InkWell and ObservableList#38767ds84182 wants to merge 1 commit intoflutter:masterfrom
ds84182 wants to merge 1 commit intoflutter:masterfrom
Conversation
Found this when using heap snapshots in Observatory to track where Image objects were being leaked. In InkWell, the highlight mode listener was being added multiple times (every time a dependency updated). This caused a leak because the number of removals did not equal the number of additions. Then in ObservableList, when items are removed from the list the set is not cleared, even though the set will be cleared and repopulated during the next call to `contains`. This caused a leak because removed items technically were not removed. This caused entire TransitionRoutes to leak in a chain. This fixes the last issues I had with image loading in Flutter.
Contributor
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. While there are exceptions to this rule, if this patch modifies code it is probably not an exception. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Closed
9 tasks
Contributor
|
@ds84182 Is it OK with you if I merge these fixes into my HighlightMode re-land PR? |
9 tasks
Contributor
|
(since it was reverted, you'd have to wait until after I commit anyhow) |
Contributor
Author
|
Sure, that's fine
…On Fri, Aug 30, 2019, 3:29 PM Greg Spencer ***@***.***> wrote:
(since it was reverted, you'd have to wait until after I commit anyhow)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#38767?email_source=notifications&email_token=AARJWZJQECSITREAR4WWOZTQHGNMVA5CNFSM4IMT3X3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5S5QKY#issuecomment-526768171>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARJWZLUHVIXJZVM32RHSIDQHGNMVANCNFSM4IMT3X3A>
.
|
Contributor
|
Closing because these fixes are incorporated in #39589 |
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.
Description
Found this when using heap snapshots in Observatory to track where Image objects were being leaked.
In InkWell, the highlight mode listener was being added multiple times (every time a dependency updated). This caused a leak because the number of removals did not equal the number of additions.
Then in ObservableList, when items are removed from the list the set is not cleared, even though the set will be cleared and repopulated during the next call to
contains. This caused a leak because removed items technically were not removed. This caused entire TransitionRoutes to leak in a chain.This fixes the last issues I had with image loading in Flutter.
Related Issues
N/A
Tests
I added the following tests:
None, I don't think there's a good way to test memory leaks right now.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?