-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Looking for volunteers to help with this!!! 🚀
Issues: all, open.
PRs: all, open.
Focus areas:
@polina-c: kick off cleanup for notGCed and integration with testWidgets
Bigger issue: #134787
Goal of this issue
- All disposables in FlutterFramework (listed below) should be instrumented for leak tracking (example).
- There should not be
.withIgnored(under flutter/test (or.withIgnored(should have a comment that explains why the ignored leaks are ok).
How to turn on leak tracking?
Leak tracking is now off by default for Flutter Framework.
To turn it on, follow the instruction.
To check your changes for leaks, temporarily turn on leak tracking, then, to merge your change, turn it off.
This PR is regularly refreshed and runs bots with leak tracking on, to verify current status of flutter master: #138581.
Steps
The goal should be achieved by iteratively instrumenting the objects and removing them from ignore lists:
-
Identify area that you plan to work on and comment on this issue so that I add you to the focus areas above so that we do not duplicate work. If your plans changed, also let me know.
-
Instrument a new class:
a. Create PR with instrumentation for one more object, mark it as draft, and check if bots pass
a. If all bots pass, merge PR
b. If number of failures is small and they are easy to fix, fix them in the same PR
c. If failures are massive or unclear, addwithIgnored(for the instrumented class either in root folder, or in sub-folder, or in a test file (in setUpAll), or for individual tests. -
Remove ignored leaks
a. IdentifywithIgnoredon any level (flutter_test_config.dart, test library or individual test), create draft PR with removed ignored leak types or classes and check if bots pass
b. If bots pass remove all inclusions (withTracked) for this class/leak-type in subsets of tests and merge the PR
c. If bots fail, return thewithIgnored, and addwithTrackedfor the leak to one of the failed tests
d. Check the list of issues/PRs for work in progress for the failure.
e. If you know how to fix the leak, fix it and merge the PR (example)
f. If the fix is unclear, removewithTracked, create an issue, link the issue in TODO for the test, and merge the PR -
While testWidgets is not integrated with leak tracking, convert
testWidgetstotestWidgetsWithLeakTrackingas instructed in phase 1
Templates
Template for steps to repro for leak issues:
- Locate the test: <perm link to the test>
- (Either) Add parameter
leakTesting = LeakTesting.settings.withTracked(classes: ['TheClass']) - (Or) Remove parameter
leakTesting = LeakTesting.settings.withIgnored(...) - See the test failing
Template for TODO:
TODO(<your alias>): fix the leak and remove ignore (or add tracking for <name of class>)
<link to the issue>
Note: your alias in TODO does not mean your obligation to fix the issue, it just indicates you have some knowledge about it.
Classes to instrument
Instrumentation for test-only classes is not a goal, but if it is needed to catch other leaks, feel free to instrument them.
- _RouteEntry
- AnimationController
- AnimationEagerListenerMixin
- BannerPainter
- ChangeNotifier
- CurvedAnimation
- DisposableBuildContext
- Element
- GestureRecognizer
- Image
- ImageInfo
- ImageStreamCompleterHandle
- Layer
- MultiDragPointerState
- OverlayEntry
- PerformanceModeRequestHandle
- Picture
- PipelineOwner
- RenderObject
- RestorationBucket
- Route
- ScrollDragController
- SelectionOverlay
- SemanticOwner
- SnapshotPainter
- State
- TextPainter
- TextSelectionOverlay
(Let me know if I missed something)