-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] Start with a smaller memory allocation for CanvasKit #56900
Conversation
skia/modules/canvaskit/BUILD.gn
Outdated
@@ -170,7 +170,7 @@ canvaskit_wasm_lib("canvaskit") { | |||
"-sFILESYSTEM=0", | |||
"-sMODULARIZE", | |||
"-sNO_EXIT_RUNTIME=1", | |||
"-sINITIAL_MEMORY=128MB", | |||
"-sINITIAL_MEMORY=64MB", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if should try 32MB. Worst case it will cost one extra 32 => 64 reallocation, and that's not too big.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this memory allocation size include textures and the onscreen render target? For reference, the initial heap size for just CPU allocations we use for Android is 4MB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh this is for the entire wasm heap? maybe 4MB isn't quite enough...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I imagine (hope?) that most textures and render targets bypass the wasm heap.
The default was to grow the memory by 20% each time. I changed it to grow by doubling to let rich apps reach their memory needs faster. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…159818) flutter/engine@9e8fcad...8d3c718 2024-12-04 [email protected] [Impeller] remove extra validation checks in GLES backend. (flutter/engine#56944) 2024-12-04 [email protected] Remove LSAN supressions for Linux embedder (flutter/engine#56913) 2024-12-04 [email protected] [web] Start with a smaller memory allocation for CanvasKit (flutter/engine#56900) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…ngine#56900) Confirmed that a sample Flutter app starts with a 32MB memory allocation for CanvasKit instead of 128MB. | Before | After| |-|-| |  |  | Fixes flutter#159499 <hr> Relevant emscripten settings: - [`INITIAL_MEMORY`](https://emscripten.org/docs/tools_reference/settings_reference.html#initial-memory) - [`ALLOW_MEMORY_GROWTH`](https://emscripten.org/docs/tools_reference/settings_reference.html#allow-memory-growth) - [`MEMORY_GROWTH_GEOMETRIC_STEP`](https://emscripten.org/docs/tools_reference/settings_reference.html#memory-growth-geometric-step) - [`MEMORY_GROWTH_GEOMETRIC_CAP`](https://emscripten.org/docs/tools_reference/settings_reference.html#memory-growth-geometric-cap) - [`ABORTING_MALLOC`](https://emscripten.org/docs/tools_reference/settings_reference.html#aborting-malloc) Relevant emscripten code: - https://github.com/emscripten-core/emscripten/blob/58889f9f20f74d0dbaed7d49025c49b864359ae1/src/library.js#L290 - Emscripten tries to grow memory by the provided growth factor. If it fails, it tries to grow by 50% of that amount. If it fails, it tries 25%. Then it gives up and fails gracefully.
Confirmed that a sample Flutter app starts with a 32MB memory allocation for CanvasKit instead of 128MB.
Fixes flutter/flutter#159499
Relevant emscripten settings:
INITIAL_MEMORY
ALLOW_MEMORY_GROWTH
MEMORY_GROWTH_GEOMETRIC_STEP
MEMORY_GROWTH_GEOMETRIC_CAP
ABORTING_MALLOC
Relevant emscripten code: