Skip to content

Android Embedding unconditionally calls NotifyLowMemory in onTrimMemory #90551

@dnfield

Description

@dnfield

Specifically, here:

https://github.com/flutter/engine/blob/dd28b6f1c8e68089dab16ebce9f629f309690027/shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java#L781-L786

Whereas we only notify the application code if the memory level is RUNNING_LOW, which also seems like a bug.

It seems like we should also notify the application if we have RUNNING_CRITICAL or if it's the LOW/CRITICAL for not running.

It also seems like we should check at least for RUNNING_LOW/RUNNING_CRITICAL before telling the Dart VM to potentially GC. On lower end devices, I've observed this particular codepath triggering a 250ms during the critical path to first frame.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)customer: money (g3)engineflutter/engine related. See also e: labels.perf: memoryPerformance issues related to memoryperf: speedPerformance issues related to (mostly rendering) speedplatform-androidAndroid applications specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions