Repository navigation
Closed
Labels
a: leak trackingIssues and PRs related to memory leaks detected by leak_trackerwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
Description
Steps to reproduce
- Run sample in web
- Observe log with leaks
- CkPicture leaks have no detailed/retaining path
This leak only applies to the web platform. Tried to check the phases to see if there was already an issue for this but couldn't find it.
cc @polina-c
Expected results
CkPicture doesn't leak when new frames are pumped.
Actual results
CkPicture leaks frequently, likely due to new frames as they won't leak without new frames. (sample uses CircularProgressIndicator to constantly request new frames).
Code sample
Code sample
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:leak_tracker/leak_tracker.dart';
void main() {
LeakTracking.start(
config: const LeakTrackingConfig(onLeaks: _onLeaks),
);
FlutterMemoryAllocations.instance.addListener(
(event) => LeakTracking.dispatchObjectEvent(event.toMap()),
);
runApp(
const MaterialApp(
home: Center(
child: CircularProgressIndicator(),
),
),
);
}
Future<void> _onLeaks(LeakSummary summary) async {
final leaks = await LeakTracking.collectLeaks();
for (final leak in leaks.all) {
print(leak.toYaml('', phasesAreTests: false));
}
}Screenshots or Video
No response
Logs
Logs
CkPicture:
identityHashCode: 599787274
...
leak_tracker: 262 memory leak(s): not disposed: 262, not GCed: 0, GCed late: 0
Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 3.19.0-9.0.pre.204, on Microsoft Windows [Version 10.0.19044.3803], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.3.5)
[√] Android Studio (version 2021.3)
[√] VS Code (version 1.85.2)
[√] Connected device (3 available)
[√] Network resourcesReacted by Polina Cherkasova
Metadata
Metadata
Assignees
Labels
a: leak trackingIssues and PRs related to memory leaks detected by leak_trackerwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
Activity
polina-c commentedon Jan 29, 2024
Thanks a lot for reporting this!!!
Steps to repro use leak tracker not in a way that is not currently tested and recommended. Can you create a widget test using this guidance and check if leaks are still detected: https://github.com/dart-lang/leak_tracker/blob/main/doc/leak_tracking/DETECT.md#test-cover-with-testwidgets
curt-weber commentedon Jan 30, 2024
Yep, I figured it was pre-emptive, I was using the live detector to locate and fix some other leaks and noticed this one likely coming from the framework. I can try to repro with testWidgets, but it says in that document you linked that web platform isn't supported yet - should I wait then? Since this leak was only observed on web. Thanks for all your great work on this!
polina-c commentedon Jan 30, 2024
Then I suggest instead of using leak tracker (that does not support reliably both web apps and running app yet), just to add temporary counting for CkPicture in your local copy of Flutter: increase global counter in constructor and decrease it in
dispose. It will give you idea how many insstances are created and not disposed.If the number turns to 0 when you stop displaying the indicator, there is no leak.
How does it sound?
github-actions commentedon Feb 20, 2024
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.
github-actions commentedon Mar 5, 2024
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.