-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
See jiahaog/bug_font_memory_multiple_engines@b794f25 for a Flutter app that can be used to repro this.
In release mode on a Pixel 6a, I collected the following profiles with the Perfetto Heap Profiler. We need to use a local unstripped engine build so that symbols from libflutter.so can be symbolicated. A userdebug build for the device may also be needed.
The number of engines can be toggled through this constant here.
- Install the app, then close it.
flutter run \ -d 'Pixel 6a' \ --release \ --local-engine=$HOME/dev/engine/src \ --local-engine=android_release_unopt_arm64 \ --local-engine-host=host_release_unopt
- Run
tools/heap_profile -n com.example.bugfontmemory
- Start the app, wait 20 sec
- Press ctrl-c in the terminal to stop recording.
Profiles:
Actually the perfetto UI is unable to handle such deeply nested stacks, but should be able to download the profiles, open it with pprof to see the following:
Observe that in the screenshot, for flutter::AssetManagerFontStyleSet::createTypeface(int), the difference here is 4.711 MiB (many engines) vs 1.577 MiB (single engine).
As mentioned by @dnfield, this is likely due to flutter/engine#34473.
This is with:
Flutter 3.20.0-10.0.pre.11 • channel main • git@github.com:flutter/flutter
Framework • revision a603a17875 (3 days ago) • 2024-02-16 09:43:50 +0200
Engine • revision dd530f1556
Tools • Dart 3.4.0 (build 3.4.0-148.0.dev) • DevTools 2.33.0-dev.6
See also http://shortn/_afwYysWZou for more details internally. I have also attached links to uploaded profiles onto pprof there.
