Repository navigation
Memory leaks occur when an activity is destroyed and recreated. Android os #173770
Copy link
Copy link
Closed
Closed
Copy link
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)Relates to speed or footprint issues (see "perf:" labels)engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.33Found to occur in 3.33Found to occur in 3.33found in release: 3.35Found to occur in 3.35Found to occur in 3.35frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onperf: memoryPerformance issues related to memoryPerformance issues related to memoryplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team
Description
Note
For anyone looking at this issue now, this leak was introduced by 233edc0 in Flutter 3.29.
1.Create a Flutter project using Android Studio.
2.Enter the developer options, set not to keep activities, (destroy each activity as soon as the user leaves it)
3.Entering the activity, clicking the home button, exiting the activity, and then entering the activity again will trigger the destruction and reconstruction of the activity.
4.Check memory leaks through profiler and find memory leaks
5.In actual use, the same problem will occur if the system kills the activity due to insufficient memory.
6.The same problem occurred with 3.27.1 and 3.32.8
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)Relates to speed or footprint issues (see "perf:" labels)engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.33Found to occur in 3.33Found to occur in 3.33found in release: 3.35Found to occur in 3.35Found to occur in 3.35frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onperf: memoryPerformance issues related to memoryPerformance issues related to memoryplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team

Activity
tirth-patel-nc commentedon Aug 14, 2025
@SJLBenjamin Report seems vague. For us to further investigate this issue, please provide a completed and minimal reproducible code sample that doesn’t include 3rd party plugins or complex production code. Also, please share the output
flutter doctor -v. Thank you!SJLBenjamin commentedon Aug 15, 2025
example:
memorydemosjl.zip
flutter doctor -v:
tirth-patel-nc commentedon Aug 15, 2025
@SJLBenjamin please confirm whether #145750, #168658 are related to your case
SJLBenjamin commentedon Aug 15, 2025
It should not be related to me, because after creating the project with Android studio, the code has not been changed, and I have the necessary path
tirth-patel-nc commentedon Aug 18, 2025
Thanks for the update. I'm observing the same behaviour on the latest SDK versions.
I enabled Don't keep activities in Developer options and tested it on both an emulator and a physical android device.
so it looks similar to #23181, but that one is too old to be a valid reference in this case.
14 remaining items
liweiGe commentedon Sep 16, 2025
[Android] Refactor `ImageReaderSurfaceProducer` restoration after app…
[Android] Refactor `ImageReaderSurfaceProducer` restoration after app…
[Android] Refactor `ImageReaderSurfaceProducer` restoration after app…
[Android] Refactor `ImageReaderSurfaceProducer` restoration after app…
[CP-stable][Android] Refactor `ImageReaderSurfaceProducer` restoratio…
[CP-beta][Android] Refactor `ImageReaderSurfaceProducer` restoration …
github-actions commentedon Oct 30, 2025
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.[Android] Refactor `ImageReaderSurfaceProducer` restoration after app…
[Android] Refactor `ImageReaderSurfaceProducer` restoration after app…